[poppler] Printing of certain PDF files does not work with "fit-to-page" because of wrong BoundingBox values in the PostScript

Martin Pahl Bugzilla at pahlx.de
Sun Oct 25 02:22:25 PDT 2015


That seems to be a problem of your email client or editor. All the files were 
created with Linux tools. I checked the attachement I sent. The line ending is 
always LF not CR/LF.

Maybe the PDP11 compiler was inefficient in compiling switch statements. To my 
understanding - and that is what I teach my students - code should be as 
understandable as possible because it's wirtten once but read many times. It's 
up to the compiler to do the optimization. But if it consensus that switch-
statement should not be used in the poppler project for any reason, I can 
alter the patch in this direction.
 
I created some more PDF examples now. example-big is a box bigger than A4 page 
size. example-small is a box smaller than A4 pages size. I rotated those PDF 
files using pdftk in all 4 directions. Then I converted the files with pdftops 
to postscript A4 paper (-paper A4) and unscaled (no options). example-all is 
the concatination (pdftk) of all example PDF files in to one multiple page file 
with different orientations. 

As these are a lot of files I did not attach them to this mail. Instead you can 
download these examples from my website at http://www.pahlx.de/poppler/

Just look at the example-all-a4.ps using gv selecting BBox and you can see 
that all PageBoundingBoxes are wrong because the are not translated to the 
output media.

Cheers,

Martin Pahl 

Am Samstag, 24. Oktober 2015, 23:27:49 schrieb William Bader:
> I noticed that the files were all in MSDOS format with CR-LF line endings,
> which corrupted the PDF, but I could fix it in emacs. Do you have sample
> files in all four orientations?  I think that it would be good to exercise
> all of the code. Does the problem happen only when the -paper option is
> used because pdftops shifts the image but (without your patch) does not
> make the corresponding changes to the bounding box? I noticed that you
> changed a sequence "if (rotate == 0) { } else if (rotate == 90) {} etc"
> into a "switch (rotate) { case 0: ... case 90: ... case 180: ... etc }".  I
> learned C in the old days on a pdp11 where a switch like that could
> generate a huge jump table.  Is that still an issue? Regards,William
> 
> From: Bugzilla at pahlx.de
> To: poppler at lists.freedesktop.org; ajohnson at redneon.com
> Date: Sat, 24 Oct 2015 18:28:07 +0200
> Subject: Re: [poppler] Printing of certain PDF files does not work
> with	"fit-to-page" because of wrong BoundingBox values in the PostScript
> 
> Attached you find an example:
> 
> example.pdf: a box generated with xfig 321mm x 106mm
> 
> example.ps generated with pdftops -paper A4 example.pdf
> example.ps:%%PageBoundingBox: 0 0 302 912
> 
> example-patched.ps generated with pdftops -paper A4 example.pdf, but with
> the patched version.
> example-patched.ps:%%PageBoundingBox: 158 0 437 842
> 
> You can view the postscript files with gv and select BBox. It's obvious that
> the unpatched PageBoundingBox is totally wrong, because source coordinates
> are used. The PageBoundingBox is bigger then the A4 paper format. It's just
> the size of the original box (302 /72 dpi * 25,4mm = 106,5mm; 912/72 dpi *
> 25,4mm = 321,73mm). But it must be the box scaled down to A4 and shifted to
> the center.
> 
> Hope this example helps.
> 
> Regards,
> 
> Martin Pahl
> 
> Am Freitag, 23. Oktober 2015, 21:46:02 schrieb Adrian Johnson:
> > On 21/10/15 03:32, Stefan Brandner wrote:
> > > ------------------------------------------------------------------------
> > > 
> > > I am using the patch now for several month and I can prove it is working
> > > fine. So if the code quality is ok for you Albert why not pushing it?
> > > 
> > > Regards
> > > Stefan Brandner
> > 
> > I'll take a look at the patch sometime in the next week. It would help
> > 
> > if you:
> >  - attach a PDF that reproduces the bug
> >  - list the pdftops options you are using
> >  - list the bounding box output you are getting and what you think
> >  
> >    it should be.
> > > 
> > > El Dijous, 7 de maig de 2015, a les 09:34:09, Martin Pahl va escriure:
> > >>/Hi, />//>/I sent patches to fix the bug:
> > >>/>//>/https://bugs.freedesktop.org/show_bug.cgi?id=87161 />//>/Those
> > >>patches were automatically sent to poppler-bugs mailing list. But>>
> > >>
> > > as I />/see no reaction to my patch submission (poppler-bugs seems to be
> > > a
> > > />/mailinglist without human interaction) I just want to ask, what is
> > > the
> > > />/right way to submit patches. / It is.
> > > 
> > > What we need is more people with time to review patches.
> > > 
> > > Cheers,
> > > 
> > >   Albert
> > >>
> > >>/By the way this bug is really annoying as it makes all PDF viewers
> > >>using
> > >>/>/poppler useless for printing documents that do not have the page size
> > >>of>>
> > >>
> > > the />/output device (e.g. printer). On the other hand acroread is not
> > > an
> > > />/alternative anymore as Adobe has discontinued support for Linux.
> > > />//>/Regards, />//>/Martin Pahl /
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > poppler mailing list
> > > poppler at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/poppler
> > 
> > _______________________________________________
> > poppler mailing list
> > poppler at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/poppler
> 
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler



More information about the poppler mailing list