Bug 9190

Summary: [PATCH] Cairo transform matrix reset in poppler_page_render
Product: poppler Reporter: Daniel Colascione <danc>
Component: cairo backendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: high    
Version: unspecified   
Hardware: All   
OS: Linux (All)   
URL: http://code.magicprints.com/poppler-render.patch
Whiteboard:
i915 platform: i915 features:

Description Daniel Colascione 2006-11-28 18:21:06 UTC
cairo_scale and other cairo transformation functions have no effect on a
subsequent call to poppler_render_page, since the Cairo backend sets the
transform matrix instead of adding to it. Since poppler_render_page doesn't take
a scaling parameter, it is impossible to use it to render a PDF at anything
other than 72 DPI.

The simple referenced patch(in the URL field) makes CairoOutputDev not reset the
transform matrix, so
cairo_scale(cairo, dpi_x / 72.0, dpi_y / 72.0); poppler_page_render(...) will do
the correct thing.
Comment 1 Kouhei Sutou 2006-12-10 06:25:19 UTC
I want poppler to accept the patch too.

I want to make a PDF file which includes thumbnail image for each page of
original PDF. To do the thing, I wrote the following code:

columns = 3;
rows = 2;

for (i = 0; i < poppler_document_get_n_pages(doc); i ++) {
  cairo_save(cr);
  column = i % columns;
  row = i / columns;
  x = (width / columns) * column;
  y = (height / rows) * row;
  cairo_translate(x, y);
  cairo_scale(cr, 1.0 / columns, 1.0 / rows);
  poppler_page_render(poppler_document_get_page(doc, i), cr);
  cairo_restore(cr);
}

I wrote a patch and started to find similar bug. And I found this bug and filed
patch was same as mine.

I'm happy if the patch is applied.f
Comment 2 Jeff Muizelaar 2006-12-11 21:24:38 UTC
Thanks for the patch.
Fixed in cvs.

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.