Closed Bug 1820651 Opened 2 years ago Closed 2 years ago

When printing a PDF using "save-to-PDF", we should default to the PDF's own page size

Categories

(Core :: Printing: Output, defect)

defect

Tracking

()

RESOLVED FIXED
114 Branch

People

(Reporter: dholbert, Assigned: fchasen)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

STR:

  1. Make sure you have about:config pref print.save_as_pdf.use_page_rule_size_as_paper_size.enabled set to true.
  2. Load attached PDF. [1]
  3. Ctrl+P to open the print dialog, and be sure you've got "Save to PDF" chosen as your print target.

EXPECTED RESULTS:
We should show a preview with the virtual PDF "paper" sized to the PDF content that we're printing.

ACTUAL RESULTS:
Print preview shows the PDF "paper" placed onto a portrait-oriented sheet of US Letter paper (or probably whatever your default was).

There's no way to get EXPECTED RESULTS for this testcase, since the PDF isn't a standard size that we have available in our paper-size dropdown.

For comparison:

  • Chrome gives EXPECTED RESULTS from these STR.
  • Firefox gives EXPECTED RESULTS if I use modified STR, just using the HTML testcase from bug 1814236 instead of the attached PDF.

[1] Note: I generated the attached testcase by simply printing bug 1814236 to PDF.

Depends on: 1793220
Attachment #9321484 - Attachment description: screenshot (pdf loaded in a tab on the left, vs. print-previewed on the right) → screenshot in Firefox showing the issue (pdf loaded in a tab on the left, vs. print-previewed on the right)
Attached image screenshot in Chrome for comparison (deleted) —

The functionality for this is already in PDF.js and the demo of the viewer adds the page size style and will print correctly: https://mozilla.github.io/pdf.js/web/viewer.html

I think we just need to move over that code from the generic print service at https://github.com/mozilla/pdf.js/blob/master/web/pdf_print_service.js#L108-L121 to the Firefox print service at https://github.com/mozilla/pdf.js/blob/master/web/firefox_print_service.js#LL136C3-L136C9

I'll can submit a PR for that over on Github.

Assignee: nobody → fchasen
Status: NEW → ASSIGNED

Thanks!

Fix for this was merged into PDF.js repo. will be included the next time the Firefox version of PDF.js is updated.

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch

Fred, is it possible to add a test for this?

Flags: needinfo?(fchasen)
No longer depends on: 1827474

:marco, yep I'll add a test that checks the print-preview size is correct.

Per the linked rotation bugs, this change makes the first page the default orientation so as you noted some of those examples will work correctly now.

But anything with mixed orientation will still rotate any page that isn't the default orientation. Unfortunately while we have good at-page support for mixed sizes / orientation, we are far from being able print mixed paper sizes so they are still scaled to the size of the first page.

Flags: needinfo?(fchasen)

Note: I suspect bug 1838989 may be a regression from this bug. (That's a bug related to printing PDFs to a label printer, where the orientation became wrong starting in Firefox 114.)

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

Attachment

General

Created:
Updated:
Size: