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

Adrian Johnson ajohnson at redneon.com
Tue Oct 27 05:38:54 PDT 2015


On 25/10/15 21:08, Stefan Brandner wrote:
> I want to summarize how the problem appears when printing the file
> Dirichlet.pdf with okular.
> Find the file at: https://bugzilla.opensuse.org/attachment.cgi?id=616147
> 
> 1. with OpenSuse 13.1 and okular 4.11.2 the CUPS command was without the
> fit-to-page option
> following commands are executed:
> pdftops Dirichlet.pdf
> lpr Dirichlet.ps
> The file was printed unscaled but centered and the printout was useful.
> 
> 2. with the actual OpenSuse 13.2 and okular 4.14.9 the CUPS command is
> now with fit-to-page and then the file is shifted to the right with half
> of the text cut
> this can be reproduced with following commands:
> pdftops Dirichlet.pdf
> lpr -o fit-to-page Dirichlet.ps
> This does not work since the BoundingBox values are incorrect.
> See explanation at CUPS documentation:
> http://www.cups.org/documentation.php/options.html

I'm not sure which application is enabling the fit-to-page or why it
changed. The fit to page would be better performed in pdftops which
already has this capability. The problem with performing a fit-to-page
based on the PS output is the Adobe Document Structuring Conventions
define the BoundingBox to be the smallest box that encloses all marks on
the page.

A PS file with correctly calculated PageBoundingBox comments is likely
have a different bounding box on each page depending on the content. If
fit-to-page is applied based on the bounding box, each page will have a
different scale factor applied. A blank page with just a page number at
the bottom will be scaled up to fit the page number to the entire page.
This is probably not what you want.

The fit-to-page feature relies on the fact that a lot of applications
just set the bounding box to the page size since computing the ink
extents of all marks on the page is not trivial.

If a future version of poppler tightened up the PageBoundingBox to make
it more correct you may find this workflow which relies on an incorrect
interpretation of the BoundingBox comment may no longer work for you.

> ------------------------------------------------------------------------------
> 
> Scaling to Fit
> 
> The -o fit-to-page option specifies that the document should be scaled
> to fit on the page:
> 
>   lp -o fit-to-page filename
>   lpr -o fit-to-page filename
> 
> The default is to use the size specified in the file.
> 
> This feature depends upon an accurate size in the print file.
> If no size is given in the file, the page may be scaled incorrectly!
> ------------------------------------------------------------------------------
> 
> 
> As mentioned in the opensuse bug:
> https://bugzilla.opensuse.org/show_bug.cgi?id=908624
> ghostscript shows Bounding Box values that do work.
> 
> Martin Pahl wrote a fix that calculates the correct page bounding values.
> With this fix above commands work without problem.
> 
> 3. another solution for the printing with okular would be calling
> pdftotops -expand Dirichlet.pdf
> lpr -o fit-to-page Dirichlet.ps
> 
> 4. also a lpr Dirichlet.pdf from the command line is working but this it
> is not the way as it is executed with okular
> 
> 5. since it is not possible to disable the fit-to-page inside okular,
> all printouts of files with wrong BoundingBox values are scrap!!!
> 
> 6. the ideal place to fix this is may be somewhere else but the solution
> from Martin fixes it for okular.
> 
> 7. I had many files with this problems and since I am using the patch
> all my printing problems are gone
> 
> Regards
> Stefan
> 
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler



More information about the poppler mailing list