Package: poppler-utils
Version: 0.10.6-1
Severity: normal

"pdftops book.pdf" produced an uncropped postscript file, whereas
"pdftops -nocrop book.pdf" produced the cropped postscript file.  The
bounding boxes are (from pdfinfo):

Page size:      504 x 648 pts
MediaBox:           0.00     0.00   612.00   792.00
CropBox:           54.00    72.00   558.00   720.00
BleedBox:          54.00    72.00   558.00   720.00
TrimBox:           54.00    72.00   558.00   720.00
ArtBox:            54.00    72.00   558.00   720.00

(The file is created by ConTeXt/pdftex and has the following tex code
to set the cropbox: \pdfpagesattr = {/CropBox [54 72 558 720]} )

The problem is (I think) fixed by the following patch:

--- poppler-0.10.6.orig/utils/pdftops.cc
+++ poppler-0.10.6/utils/pdftops.cc
@@ -341,7 +341,7 @@
                          duplex);
   if (psOut->isOk()) {
     doc->displayPages(psOut, firstPage, lastPage, 72, 72,
-                     0, !noCrop, gFalse, gTrue);
+                     0, noCrop, !noCrop, gTrue);
   } else {
     delete psOut;
     exitCode = 2;

Explanation: In the unpatched function call, !noCrop is passed in as
useMediaBox into displayPages(), and gFalse is passed in as crop into
displayPages().  But, from staring at the code, it seems that
useMediaBox is the opposite of crop, so useMediaBox should be given
noCrop and crop should be given !noCrop.  Which is what the patched
call does.

The code feels fragile in having two variables that are synonyms
(useMediaBox and noCrop) that turn into (via function calls) two
variables that are antonyms (useMediaBox and crop) and have to be kept
in sync.  Why not just have one variable (e.g. useMediaBox)?

Leaving that aside, I am not sure that the patch above is the whole
fix.  The last few lines of makeBox() (in poppler/Page.cc) are:

  } else if (useMediaBox) {
    *box = *mediaBox;
  } else {
    *box = *cropBox;
    *crop = gFalse;
  }

The else-if clause looks okay, even if fragile, since *crop should
already be passed in as gFalse (since useMediaBox is true).  But the
else clause looks suspicious.  If useMediaBox is false, then the
cropBox is being used, so why is *crop then set to false?  Is it
because the calling function doesn't want cropping on top of using the
cropBox?

I wasn't sure about what was going on there, so I left those lines
alone, and just patched the call in pdftops.cc.

With the patch, pdftops handles -nocrop correctly on book.pdf.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.30 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages poppler-utils depends on:
ii  libc6                  2.9-19            GNU C Library: Shared libraries
ii  libfontconfig1         2.6.0-4           generic font configuration library
ii  libfreetype6           2.3.9-5           FreeType 2 font engine, shared lib
ii  libgcc1                1:4.4.0-10        GCC support library
ii  libjpeg62              6b-14             The Independent JPEG Group's JPEG 
ii  libopenjpeg2           1.3+dfsg-4        JPEG 2000 image compression/decomp
ii  libpoppler4            0.10.6-1          PDF rendering library
ii  libstdc++6             4.4.0-10          The GNU Standard C++ Library v3
ii  libxml2                2.7.3.dfsg-1      GNOME XML library
ii  zlib1g                 1:1.2.3.3.dfsg-14 compression library - runtime

Versions of packages poppler-utils recommends:
ii  ghostscript                 8.64~dfsg-12 The GPL Ghostscript PostScript/PDF

poppler-utils suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to