Issue with PDF printing via cairo library – Proposed Patch
Vladimir Gribko
Vladimir.Gribko at cib.de
Mon Jul 21 08:10:09 UTC 2025
Hello cairo developers,
I am a C++ developer at CIB software GmbH, and we use cairo for rendering and printing PDF documents within our product, CIB pdf toolbox 2.
Recently, we encountered an issue when printing certain PDF with the "Microsoft Print to PDF" printer: the output PDF appeared distorted.
We couldn't find a problem in our code, and for further testing we printed this PDF, using the well-known open-source utility pdftocairo:
> pdftocairo.exe -print -printer "Microsoft Print to PDF" input.pdf output.pdf
We observed the same result with pdftocairo and therefore suspected a problem in the cairo code.
Upon analyzing the problem, we identified two issues within the function _cairo_win32_printing_surface_paint_recording_pattern():
1. The use of an uninitialized variable, is_subsurface.
2. Displaced ClipPath for the pattern being printed, which leads to the distorted output.
We have developed a patch addressing these two issues and would like to propose it for inclusion in the cairo code.
Additionally, I have attached the minimized input.pdf and the distorted output.pdf obtained with pdftocairo.
So, please review and share your feedback.
Thank you for your attention.
Best regards,
Vladimir Gribko.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20250721/c7dd0373/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: input.pdf
Type: application/pdf
Size: 24982 bytes
Desc: input.pdf
URL: <https://lists.cairographics.org/archives/cairo/attachments/20250721/c7dd0373/attachment-0002.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: output.pdf
Type: application/pdf
Size: 41894 bytes
Desc: output.pdf
URL: <https://lists.cairographics.org/archives/cairo/attachments/20250721/c7dd0373/attachment-0003.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix.diff
Type: application/octet-stream
Size: 1726 bytes
Desc: fix.diff
URL: <https://lists.cairographics.org/archives/cairo/attachments/20250721/c7dd0373/attachment-0001.obj>
More information about the cairo
mailing list