mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.6k stars 9.99k forks source link

Printing PDF with minimal margin gets truncated on paper #15412

Open ediweissmann opened 2 years ago

ediweissmann commented 2 years ago

Attach (recommended) or Link to PDF file here: print-test-minimal-margin-a4.pdf

Configuration:

Steps to reproduce the problem:

  1. Drag and drop PDF to demo viewer
  2. Click the Print icon (top right)
  3. In the Print dialog that appears just leave everything as default and print.

What is the expected behavior? (add screenshot) That the document is printed without being truncated on the sides.

What went wrong? (add screenshot) Top and left margins are truncated on paper, see screenshots: IMG-7939 IMG-7940

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): N/A

shaymerrill-mc commented 1 year ago

I'm trying to understand more about this issue as we're seeing a similar issue with some of our documents. We considered adding some margins by default in the CSS for the print media but so far that has had undesirable outcomes (like shifting/resizing content).

From what I can tell only some printer models support "full bleed" or "borderless" printing. Most printers have a "non-printable margin" around the edges of the sheet. It's size varies from printer to printer. In these cases, there is no way to print to the edges.

Depending on the print dialog and printer/print-driver used when printing your document (chrome, edge, firefox, windows, mac, linux, printer-specific, etc) you will likely have some sort of scaling options. Many times there is an option to "fit" or "fit to printable area". From what I can tell, these types of settings are sometimes selected by default so most people don't notice them. I don't think there is any way to configure any of these settings from Javascript. Also, it's not very common to have a document that has content outside the printable area.

I'd love to hear what the repo maintainers have to say, but I'm thinking the only options here are manual intervention of print settings during printing, or possibly print media margins in the CSS.

muramasatheninja commented 11 months ago

Wasted a lot of paper trying to troubleshoot this. Firefox has lots of settings do adjust margins but not for pdfs. I need a way for firefox to drop the pdf down the page about 0.25 inches but there doesn't seem to be a way.