For printing on Dabian and Ubuntu GTK/GNOME-based applications (like evince) generate PDF with Cairo and send it to CUPS. CUPS calls Ghostscript to convert this PDF into the printer's native data format. Problem is that the PDF generated by Cairo renders very slowly with Ghostscript in the printing-typical resolutions of 600dpi and more. This is caused by pointless use of transparency also if only opaque objects are drawn and in addition, the bounding boxes of the transparency groups are always the entire page. Since Ghostscript has to allocate memory to hold the raster data for each transparency the overall memory consumption can get multiples of the memory needed for th final page's raster data, making the machine swapping to the death. Can this be improved? PDF-based printing got standard now. Sample bug reports: https://bugs.launchpad.net/ubuntu/+source/ghostscript/+bug/968785 https://bugs.launchpad.net/ubuntu/+source/ghostscript/+bug/668800 (comment #36) http://bugs.ghostscript.com/show_bug.cgi?id=692959
The page sized bounding boxes problem has been fixed in 1.12.0. The use of transparency groups for opaque objects is something that can be improved.
Can you give me a patch for 1.10.2 which I could apply to the Ubuntu Precise (12.04) package?
There are too many changes.
To make printing also working well on mobile and generally low-performance devices it gets very important to completely do away with transparency in PDF output, at least if the document does not actually contain any transparent graphical elements. We should perhaps even make one output mode optimized for printing with no transparency at all. This would allow fast print rendering, especially also on mobile. Ghostscript developers suggest PDF/X-1 output here. Another mode could use transparency only where it is actually needed, for getting small, efficient PDF files for archiving and web download. We should raise priority for this as slow printing is a very common problem under Linux (and mostly caused by the transparency abuse in Cairo output) and Linux gets more and more used on mobile battery-driven devices.
More Ubuntu bug reports showing this problem: https://bugs.launchpad.net/bugs/980616 https://bugs.launchpad.net/bugs/1159452
If I understand this correctly, this was fixed with cairo 1.12. At least Adrian claims so and no one claimed anything else.
I've pushed out a fix to make transparency groups normal groups when the content is opaque.
Adrian, can you post the patch or tell which commit it is, so that I can apply it to the current Poppler in Ubuntu?
Apply to Poppler? This is a bug about cairo...? The commit that Adrian meant is: http://cgit.freedesktop.org/cairo/commit/?id=8addb4798c918000eaa6f6dab138e0abb0efa946 And the following two patches fix some problems with it: http://cgit.freedesktop.org/cairo/commit/?id=a6f51fed985f7db37c672bab0b5dab3f89e78282 http://cgit.freedesktop.org/cairo/commit/?id=279d5a2ed1aaa6d5dbfbeab9e4b4ffa6a66aa6f3 No idea if this can be backported sanely to older cairo versions, good luck.
I have not tried it but I expect those three patches should apply to 1.12.4 or later as not much has changed since then. I would also recommend applying this patch to improve printing performance: http://cgit.freedesktop.org/cairo/commit/?id=266d6e71566ac8c5e360c0b32fb78e23e6a06168 This patch fixes the embedding of jpeg data in the pdf output. Without it the file size will be a lot larger.
> I have not tried it but I expect those three patches should apply to 1.12.4 > or later That should be 1.12.14 or later.
Thank you very much, the patches apply perfectly on Ubuntu's Cairo package (1.12.16). I have applied them to the Ubuntu package now.
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.