Re: Gtk Printing and evince
- From: Christian Persch <chpe gnome org>
- To: gtk-devel-list gnome org
- Subject: Re: Gtk Printing and evince
- Date: Wed, 19 Jul 2006 15:38:41 +0200
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...
> 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. 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.
Regards,
Christian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]