Re: Gtk Printing and evince



El mié, 19-07-2006 a las 15:38 +0200, Christian Persch escribió:
> Hi,
> 
> > I'm porting evince from gnome-print to gtk-print, but I have some
> > doubts. 
> > 
> > In evince we have the document pages already rendered, so can I take the
> > pixbuf of the page and create a cairo surface from it and use it in
> > draw_page signal? I don't know if this is the right way to do it. 
> 
> I don't think you should use the pixbuf of the page, but instead use the
> cairo context you get in the draw_page signal to draw the page to it
> using poppler_page_render...

The problem is that it will only work for pdf documents. 

> > Right now in evince we generate a ps file and use
> > gnome_print_job_set_file (). By using  GtkPrintUnixDialog and
> > GtkPrintJob instead of GtkPrintOperation, it works, I only had to use
> > gtk_print_job_set_source_file () in the same way we used
> > gnome_print_job_set_file (). 
> > 
> > Which is the right way to do it? Can we avoid creating a temporary ps
> > file with GtkPrintOperation? or should we use GtkPrintUnixDialog
> > directly? 
> 
> If the selected printer supports PDF (gtk_printer_accepts_pdf) [and the
> selected paper format is the same as the document's] I think it would be
> best to send the original pdf to the printer instead of a PS file
> generated from it. 

Yeah, that's exactly what I'm doing. 

> If the printer does not support PDF or you'll have to
> transform the page since the paper formats don't match, you could either
> generate PS or use the poppler_page_render API in draw_page...
> But GtkPrintOperation doesn't supports that mixed mode (send file to
> printer in one case, render page to cairo_t in the other case) at all,
> so you may really need to use GtkPrintUnixDialog directly.

Ok, thank you very much.

> Regards,
> 	Christian
> 
-- 
Carlos Garcia Campos (KaL)
   elkalmail yahoo es
   carlosgc gnome org
   http://carlosgc.linups.org
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462

Attachment: signature.asc
Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente



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