Bug: Scaling for PDF Printing not accounting for border and doesn't upscale
Status: RESOLVED
Priority: --
Resolution: FIXED
Created: 2021-02-04 17:17:58+00:00
Resolved: 2022-01-24 21:31:07+00:00

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

I have two related things here at once.

Check the attached file for the examples I'm talking about here.

1st issue: When Printing PDF from pdfjs, the option "scale the PDF to the width" (Sorry, I cannot tell you the exact english wording, I'm using the browser in german, I mean this thing: http://prntscr.com/yaka78 ) is indeed able to scale down a PDF to the target paper size if its too large, but it does not account for borders.

You can see that if you take "SourceFile_A4.pdf" and print it to an actual hardware A4 printer, it does not scale it down a little but cuts off the borders "Firefox_print_toPrinter_A4-to-A4.pdf".

A native PDF reader like Foxit Reader does scale it down to account for borders too, if the autoscale option is used, like in "Foxit_print_toPrinter_A4-to-A4.pdf".

This can somewhat be reproduced with a virtual printer, CutePDF Writer in my Case, too, see "Firefox_print_toCutePDFWriter_A4-to-A4.pdf". Borders are not really cut off though because the PDF-Printer is able to print borderless.

Im my opinion it should account for the borders as well and scale down the PDF so the entire content makes it to the page, because thats what the autoscale option is for. Otherwise I'd use 100%, if I'd prefer true file-to-paper-mapping.


2nd issue: The autoscale option does not scale up at all. If the PDF is smaller than the target paper size, like taking "SourceFile_A5.pdf" and printing it to A4.

See "Foxit_print_toPrinter_A5-to-A4.pdf", this is Foxit Reader again with the autoscale option enabled, it screches everything up, accounts for borders, basically no difference to the A4 source file, like it should be.

Print with Firefox: "Firefox_print_toPrinter_A5-to-A4.pdf" It does not scale up, it also doesn't center it but dashes it in the left upper corner and also cuts of borders again.

Print to virtual Printer with Firefox: "Firefox_print_toCutePDFWriter_A5-to-A4.pdf", again no upscaling, dashing it in the left upper corner, content entirely visible due to the virtual printer not cutting off borders.

This was testet with two different hardware printers from different vendors (a Kyocera P225dn and a HP LJ 4250) with both printers having the same output as well as the CutePDF Writer virtual PDF Printer. The virtual Printer is not really important but I tested it anyway as it may be the easiest to reproduce.

I testet with Firefox ESR 78.7 64-bit as well as Firefox Nightly 87.0a1 (2021-02-04) (64-Bit). Same result in both browsers, the samples were made with Nightly.

I'd ask you kindly to implement a fix to PDF printing from Firefox for both the not-account-for-printing-border issue as well as the not-able-to-upscale-smaller-pdfs issue.

I'm asking for this because our company uses a web-based document management system with embedded PDFs that get loaded via pdfjs. Yes I can download a pdf, open it with something else and print it then, but this isn't really a great workflow if you (or in our case our users) have to do that frequently. And I cannot really control whats inside that document management system, as its just a bunch of stuff from other people, companies and governments. So it would be nice if the printing feature would be spot on.


Actual results:

Printing does not account for borders on printed paper and does not scale up PDFs smaller than the target paper and dashes them in the left upper corner at native size.


Expected results:

It should scale smaller PDFs to the given paper size and also account for border and scale content appropriately.