Re: Problem with preview and the blocking print dialog

On Wed, 2006-05-10 at 16:51 -0500, Federico Mena Quintero wrote:
> On Wed, 2006-05-10 at 17:42 -0400, John (J5) Palmieri wrote:
> > I'm implementing the preview code in gtkprint.  I have decided to use an
> > external helper (default is evince) to do print preview.  The idea was
> > to write out to a pdf in /tmp and launch the external helper when the
> > user hits the preview button.
> <ignorant>
> Why do we have an external helper?
> Gnome-print would save everything to its own internal metafile, and then
> it would spit it to a gnome-canvas.  Could we make Cairo just render
> everything to a preview window?
> </ignorant>

So, I think everyone agrees on this approach:
1) run the print loop on a cairo surface producing a metafile of some
2) display the metafile in a window which allows you to flip between
pages, zoom in/out, etc.

Now, the metafile format could be some special cairo format, or it could
equally well be PDF. It would have to be written to a file anyway, for
scalability reasons we don't want to keep it in memory.

I think the best way to do this is to rely on an external helper. For a
couple of reasons:
* Running something as complicated as a document viewer in the same
process as the application scares me for stability reasons. Its easy for
a bug in the viewer to bring the whole app down, or to affect it badly.
* Writing a good viewer is hard. Its not just about rendering the
metafile to a window and adding next/prev buttons. The people working on
evince have learnt this, and they have created a very nice viewer. This
would just be a massive amount of duplicative work.
* Using pdf for the metafile format gives a slightly better chance of
the preview being "accurate", given that this uses most of the actual
real printing codepaths.

On unix we could use evince (or another pdf viewer of your choice), on
OSX we could use, and on Windows we could generate a .emf
file (easy with cairo) and use the emf viewer that ships with windows.

 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an oversexed devious cop with a winning smile and a way with the ladies. 
She's a wealthy wisecracking schoolgirl with a birthmark shaped like Liberty's 
torch. They fight crime! 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]