cairo_pdf_surface_set_size misbehaves with non integral width/height
Creating a pdf file with a non-white background color (through a call to cairo_paint(cr)
) results in a page with a white stripe on the right and bottom sides if cairo_pdf_surface_set_size()
was called on the surface.
The stripes do not appear if cairo_pdf_surface_set_size()
was never called.
Here is a MWE: test.c
And the resulting pdf file: test.pdf
Comment out the lines
cairo_pdf_surface_set_size(surface,
X_INCHES * 72.0,
Y_INCHES * 72.0);
and you'll see the faulty stripes are no longer there.
Note: The stripes only appear if the page width/height are not integers (in points). The MWE is made for the A4 paper format (whose width and height are not round numbers in points).