unable to print entire pdf for some files in evince

Bug #1159452 reported by Anton Kanishchev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libcairo
Fix Released
High
cairo (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Pdfs from the web (varying size , from 100kb to 60-80 MB), print absolutely fine.

However printing of generated pdfs does not work-- only prints first 2 pages, and then one blank page for the rest.

If it makes any difference the pdf was exported from gummi (latex editor), it shows up fine in evince but prints only 2 pages.

The printer is an hp8600 n911a

prints all other files ok.
***********************************UPDATE*******************************************************
installing okular and setting that as default fixes this problem, however
this is a major bug as the default document viewer is evince in ubuntu
********************************************UPDATE____END*****************************
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: evince 3.4.0-0ubuntu1.6
ProcVersionSignature: Ubuntu 3.5.0-26.42~precise1-generic 3.5.7.6
Uname: Linux 3.5.0-26-generic x86_64
ApportVersion: 2.0.1-0ubuntu17.1
Architecture: amd64
Date: Sun Mar 24 15:57:37 2013
InstallationMedia: Ubuntu 12.04.2 LTS "Precise Pangolin" - Release amd64 (20130214)
MarkForUpload: True
ProcEnviron:
 LANGUAGE=en_GB:en
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: evince
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

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

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :

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.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Can you give me a patch for 1.10.2 which I could apply to the Ubuntu Precise (12.04) package?

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :

There are too many changes.

Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

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.

Revision history for this message
Anton Kanishchev (ak12-deactivatedaccount) wrote :
description: updated
affects: evince (Ubuntu) → cups (Ubuntu)
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The problem is most probably caused by Cairo, the graphics library which generates the PDF print jobs for evince (note that evince does no simply pass the PDF input files through to the printer, it re-generates them, and usually in a very awkward way).

Anton, can you please attach a sample PDF which you cannot print with evince? Thanks.

affects: cups (Ubuntu) → cairo (Ubuntu)
Changed in cairo (Ubuntu):
importance: Undecided → High
status: New → Incomplete
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :
Changed in libcairo:
importance: Unknown → High
status: Unknown → Confirmed
Revision history for this message
Anton Kanishchev (ak12-deactivatedaccount) wrote :

Sure, here is a sample pdf.

Revision history for this message
In , Psychon-d (psychon-d) wrote :

If I understand this correctly, this was fixed with cairo 1.12. At least Adrian claims so and no one claimed anything else.

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :

I've pushed out a fix to make transparency groups normal groups when the content is opaque.

Changed in libcairo:
status: Confirmed → Fix Released
Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Adrian, can you post the patch or tell which commit it is, so that I can apply it to the current Poppler in Ubuntu?

Revision history for this message
In , Psychon-d (psychon-d) wrote :

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.

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :

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.

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :

> 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.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Attached is a debdiff applying the fix of the upstream bug to the current Saucy package of Cairo in Ubuntu. Please upload this package.

Changed in cairo (Ubuntu):
status: Incomplete → In Progress
status: In Progress → Fix Committed
Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

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.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cairo - 1.12.16-0ubuntu2

---------------
cairo (1.12.16-0ubuntu2) saucy; urgency=low

  * debian/patches/pdf-output-avoid-transparency.patch: PDF output: Avoid
    making groups a transparency group if not required (LP: #668800,
    LP: #968785, LP: #980616, LP: #1159452, upstream bug #48260).
  * debian/patches/pdf-output-mime-data-embedding.patch: PDF output: Fix
    embedding of mime data, improves printing performance especially on
    PDF output with embedded JPEG (Upstream bug #48260, comment #10).
 -- Till Kamppeter <email address hidden> Mon, 16 Sep 2012 10:28:27 +0200

Changed in cairo (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.