It would be wonderfully if poppler provide setPaperColor for CairoOutputDev as it provided it for SplashOutputDev.
I'm not sure we need it in CairoOutputDev, why not just filling the surface before rendering?
You right. I look to demo, this way work for cairo, but not for poppler_page_render_to_pixbuf My changes in demo to test: diff -ur poppler-0.10.4-orig/glib/demo/render.c poppler-0.10.4/glib/demo/render.c --- poppler-0.10.4-orig/glib/demo/render.c 2008-10-09 23:30:34.000000000 +0300 +++ poppler-0.10.4/glib/demo/render.c 2009-02-23 20:18:30.000000000 +0200 @@ -172,7 +172,7 @@ cr = cairo_create (demo->surface); cairo_save (cr); - cairo_set_source_rgb (cr, 1, 1, 1); + cairo_set_source_rgb (cr, .5, .5, .5); cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); cairo_restore (cr); @@ -209,7 +209,7 @@ timer = g_timer_new (); demo->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height); - gdk_pixbuf_fill (demo->pixbuf, 0xffffff); + gdk_pixbuf_fill (demo->pixbuf, 0x808080); poppler_page_render_to_pixbuf (page, x, y, width,
(In reply to comment #2) > You right. I look to demo, this way work for cairo, but not for > poppler_page_render_to_pixbuf yes, but that's an issue in the glib bindings not in CairoOutputDev. I haven't look at it in detail, but I'd say it's not possible to fix it without breaking the API. Anyway, I think non cairo API will be deprecated in the glib bindings sooner or later.
The poppler_page_render_to_pixbux api has been removed. The correct way to set the paper color is to first render to a transparent surface then paint the surface over the paper color. eg surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, IMAGE_DPI*width/72.0, IMAGE_DPI*height/72.0); cr = cairo_create (surface); cairo_scale (cr, IMAGE_DPI/72.0, IMAGE_DPI/72.0); poppler_page_render (page, cr); cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OVER); cairo_set_source_rgb (cr, 1, 1, 1); // Set paper color cairo_paint (cr);
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.