Poppler's pdftops fails to convert a PDF file to PostScript

Bug #335397 reported by Arno Peters
10
Affects Status Importance Assigned to Milestone
Poppler
Fix Released
Medium
poppler (Ubuntu)
Fix Released
Medium
Unassigned
Jaunty
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: foomatic-filters

The attached PDF will trigger a /usr/lib/cups/filter/foomatic-rip failed error message no output will be produced and the printjob will get status stopped.

How to repeat:
  $ lp afdruk.pdf

Additional info:

$ lsb_release -rd
Description: Ubuntu 8.10
Release: 8.10

$ apt-cache policy foomatic-filters
foomatic-filters:
  Geïnstalleerd: 4.0.0-0ubuntu3
  Kandidaat: 4.0.0-0ubuntu3
  Versietabel:
 *** 4.0.0-0ubuntu3 0
        500 http://nl.archive.ubuntu.com intrepid-updates/main Packages
        100 /var/lib/dpkg/status
     4.0.0~bzr177-0ubuntu1 0
        500 http://nl.archive.ubuntu.com intrepid/main Packages

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

Can you run the following commands in a terminal window:

cancel -a
cupsctl LogLevel=debug

Then print the file again and as soon as the job disappears or goes into "Stopped" state, do

sudo cp /var/log/cups/error_log ~
sudo chmod 777 ~/error_log

and attach the ~/error_log file to this bug report.

Changed in foomatic-filters:
status: New → Incomplete
Revision history for this message
Arno Peters (awpeters) wrote :

This log is from a different computer, using a different printer but it generates the same error message. I can reliably reproduce this error.

Revision history for this message
Lars Karlitski (larsu) wrote :

Ghostscript dies because the PostScript file which is generated by pdftops is not valid. I have verified this by manually calling pdftops and feeding that into GhostScript. Feeding it the original PDF works.

Till, where is pdftops maintained? In the CUPS project?

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

Created an attachment (id=23437)
PDF file from which pdftops produces broken PostScript

The PostScript which comes out when converting the attached PDF file via

pdftops afdruk.pdf

is broken. Ghostscript 8.64 gives the following error:

till@till-laptop:~/ghostscript/gpl/testfiles$ gs afdruk.ps
GPL Ghostscript 8.64 (2009-02-03)
Copyright (C) 2009 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /syntaxerror in -file-
Operand stack:
   --nostringval-- --nostringval-- --nostringval-- 19
Execution stack:
   %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1862 1 3 %oparray_pop 1861 1 3 %oparray_pop 1845 1 3 %oparray_pop 1739 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push
Dictionary stack:
   --dict:1147/1684(ro)(G)-- --dict:0/20(G)-- --dict:70/200(L)-- --dict:87/150(L)--
Current allocation mode is local
Current file position is 257319
GPL Ghostscript 8.64: Unrecoverable error, exit code 1
till@till-laptop:~/ghostscript/gpl/testfiles$

till@till-laptop:~/ghostscript/gpl/testfiles$ pdftops --version
Error: Couldn't open file '--version'
till@till-laptop:~/ghostscript/gpl/testfiles$ pdftops -version
Error: Couldn't open file '-version'

Version of pdftops:

till@till-laptop:~/ghostscript/gpl/testfiles$ pdftops
pdftops version 0.10.3
Copyright 2005-2009 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2004 Glyph & Cog, LLC
Usage: pdftops [options] <PDF-file> [<PS-file>]
...
till@till-laptop:~/ghostscript/gpl/testfiles$

Problem was observed on Ubuntu Intrepid and Jaunty. Original bug report:

https://bugs.edge.launchpad.net/ubuntu/+source/poppler/+bug/335397

Revision history for this message
Till Kamppeter (till-kamppeter) wrote : Re: foomatic-rip fails to rip PDF

pdftops is part of the CUPS package, but in Debian and Ubuntu it is replaced by the current snapshots of the pdftops filter of CUPS 1.4. This is done to avoid duplication of the source code of Poppler/XPDF as CUPS 1.3.x contains a complete copy of XPDF to implement the pdftops filter. These duplications have to be avoided in distros to facilitate security bug fixes and to save CD space.

Arno is using Intrepid and there the pdftops filter has called /usr/bin/pdftops, a part of Poppler. So the bug is either in Poppler, producing bad Postscript or in Ghostscript having problems with Poppler's Postscript. To check this, someone should try to send the output of "pdftops afdruk.pdf" to a native PostScript printer to see whether the printer understands Poppler's PostScript. This bug is not a bug of foomatic-filters.

To exclude the pdftopdf filter from being the culprit I did

pdftops afdruk.pdf
gs afdruk.ps

and Ghostscript showed the same error as it showed in the attached error_log. So upstream bugs on Poppler (and perhaps Ghostscript) need to be filed.

In Jaunty this bug does not occur, as there is a newer version of the pdftops filter from CUPS 1.4 which uses Ghostscript.

Arno, you can easily work around the bug. Remove your print queue and create a new one. Then a newer PPD file is used which uses a more straightforward filter workflow without pdftops. Then your file should print.

Changed in foomatic-filters:
importance: Undecided → Medium
status: Incomplete → Triaged
Changed in poppler:
status: Unknown → Confirmed
Revision history for this message
In , Till Kamppeter (till-kamppeter) wrote :

Created an attachment (id=26437)
Patch to fix this bug

I have found the cause of the problem. ASCII85-encoded binary data was not correctly copied from the PDF input file. Patch attached.

Revision history for this message
In , Albert Astals Cid (aacid) wrote :

It seems i already commited that patch in master as part of other bugfix, can you confirm git master is ok? The attached document seems to work.

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

I do not have the GIT repo of Poppler handy here, but if you have checked that the attached file is correctly converted (result displays with Ghostscript or prints on PS printer when sending unfiltered) it is OK and you can mark the bug as fixed. You can also check the poppler/PSOutputDev.cc file whether my two insertions are actually there.

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

I have checked in the web interface of the GIT repo now. There is only one of my insertions, the one where the array gets actually written. This fixes the bug but the array will be created one unit too big. In my patch I do the same insertion also in the pre-calculation of the array size. See my patch and compare with

http://cgit.freedesktop.org/poppler/poppler/tree/poppler/PSOutputDev.cc

Revision history for this message
In , Albert Astals Cid (aacid) wrote :

Right, i did not check correctly and was misled by a similar check in the above line.

Commited now.

Changed in poppler (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The attached debdiff fixes this bug and bug 382379.

Changed in poppler (Ubuntu):
status: In Progress → Fix Committed
Changed in poppler:
status: Confirmed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package poppler - 0.11.0-0ubuntu3

---------------
poppler (0.11.0-0ubuntu3) karmic; urgency=low

  * debian/patches/15_poppler-ps-output-broken-binary-encoding-fix.patch:
    Fixed bug in copying ASCII85-encoded binary data from the PDF input
    file which produced broken PostScript (LP: #335397).
  * debian/patches/10_pdftops-multiple-page-size-support.patch: Added new
    output mode to the PostScript output device, so that the original page
    sizes of PDF documents with multiple page sizes stay conserved
    (LP: #382379).

 -- Till Kamppeter <email address hidden> Thu, 4 Jun 2009 18:24:49 +0200

Changed in poppler (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted poppler into jaunty-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in poppler (Ubuntu Jaunty):
status: New → Fix Committed
tags: added: verification-needed
Changed in poppler (Ubuntu Jaunty):
status: Fix Committed → Fix Released
Changed in poppler:
importance: Unknown → Medium
Changed in poppler:
importance: Medium → Unknown
Changed in poppler:
importance: Unknown → Medium
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.