Open Bug 1406098 Opened 2 years ago Updated 3 months ago

pdfjs.enablePrintAutoRotate doesn't work

Categories

(Firefox :: PDF Viewer, defect, P3)

57 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: jjackson, Unassigned)

References

Details

(Whiteboard: [pdfjs-c-printing])

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170921064520

Steps to reproduce:

Set the preference pdfjs.enablePrintAutoRotate to true, opened a landscape-oriented PDF, printed.


Actual results:

It printed in portrait.


Expected results:

It should have printed in landscape.
Component: Untriaged → PDF Viewer
See Also: → 1282045
Attached file Letter-Landscape.pdf
Attached file A4-Landscape.pdf
More information:
https://github.com/mozilla/pdf.js/pull/8043
Was this previously working for you?
Flags: needinfo?(jjackson)
(In reply to Brendan Dahl [:bdahl] from comment #4)
> Was this previously working for you?

I wasn't using it previously, I just learned about the feature now.  From what I understand, it was added in 54.

https://hg.mozilla.org/mozilla-central/rev/e28772b44058

Our users have been asking for this feature ever since we switched from the Adobe Reader plugin to PDF.js.  It's standard behaviour across different applications I've tried that the document's orientation determines the default print orientation.  I see no reason why it shouldn't be the same for PDF.js.  I guess what I'm saying is not only should this preference be working, its default should be true.
Flags: needinfo?(jjackson)
Perhaps Ryan VanderMeulen, the change author, can help us.
Flags: needinfo?(ryanvm)
I just do the syncs with the upstream repository. Not a pdf.js coder otherwise :)

More discussion upstream if it helps:
https://github.com/mozilla/pdf.js/pull/8043
Flags: needinfo?(ryanvm)
Priority: -- → P3
Whiteboard: [pdfjs-c-printing]

The referenced preference controls a feature in pdf.js that auto-rotates pages 2-n to make them consistent with the orientation of page 1.

The problem of a landscape PDF printing portrait (or vice versa) is because Firefox does not detect the page orientation of page 1 of a PDF and simply uses the last saved orientation for the current printer. (The same is true of paper size, but that's a different bug.)

Can pdf.js solve this with CSS combined with its knowledge of the content? There are some media queries that can help with adapting to an unknown orientation, but I don't know what is involved in making it work:

@media print and (orientation: portrait) {
  /* Rotate page if it is landscape */
}
@media print and (orientation: landscape) {
  /* Rotate page if it is portrait */
}

If pdf.js can't do that well, another approach would be to for Firefox to disregard the saved orientation when printing PDFs and use the orientation of the page 1 of the PDF on a one-off basis that doesn't affecting printing of web pages afterwards. I'm not sure how that would integrate with Print Preview if a user passes through that screen and wants to modify the orientation themselves.

You need to log in before you can comment on or make changes to this bug.