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/668800 (comment #36)
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:
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:
And the following two patches fix some problems with it:
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:
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.