Re: Gtk Printing and evince
Hi Carlos, 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. Unless rendered at a high resolution, the output will probably look pretty ugly and be much larger than strictly necessary. Since poppler has a Cairo rendering backend and the GtkPrintContext pipeline is built around cairo, it'd probably be better to do something like this pseudo-code: cairo_t = gtk_print_context_get_cairo(context) for page in document.pages: poppler_page_render(page, cairo_t) Best, Dom -- Counting bodies like sheep to the rhythm of the war drums. ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: Gtk Printing and evince
El mié, 19-07-2006 a las 08:20 -0400, Dominic Lachowicz escribió: Hi Carlos, 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. Unless rendered at a high resolution, the output will probably look pretty ugly and be much larger than strictly necessary. Since poppler has a Cairo rendering backend and the GtkPrintContext pipeline is built around cairo, it'd probably be better to do something like this pseudo-code: cairo_t = gtk_print_context_get_cairo(context) for page in document.pages: poppler_page_render(page, cairo_t) Yes, I thought in something like this too, but it will only work with pdf and evince is not only a pdf viewer. Best, Dom Thanks, -- Carlos Garcia Campos (KaL) [EMAIL PROTECTED] [EMAIL PROTECTED] http://carlosgc.linups.org PGP key: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x523E6462 signature.asc Description: Esta parte del mensaje está firmada digitalmente ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: Gtk Printing and evince
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 ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list