Closed Bug 1672529 Opened 4 years ago Closed 4 years ago

When printing, PDFs are misaligned and clipped in v82 due to extra margins

Categories

(Core :: Printing: Setup, defect, P1)

Firefox 82
defect

Tracking

()

VERIFIED FIXED
84 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox81 --- unaffected
firefox82 + verified
firefox83 + verified
firefox84 + verified

People

(Reporter: flaviobombonatti, Assigned: jfkthame)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [print2020_v82][old-ui+])

Attachments

(3 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:82.0) Gecko/20100101 Firefox/82.0

Steps to reproduce:

*My FF version is not using the Chromium print prompt.
*macOS Catalina (10.15.7)

  1. Open example PDF: https://food-guide.canada.ca/static/assets/pdf/HEPs-Guide-nw-en.pdf
  2. Click printer icon.
  3. Set Paper size to "Letter". Set scale to 100%.
  4. Print OR Open with Preview.

Actual results:

There appear to be extra margins at the top and left sides, pushing some content off the printed document. Please see screenshot attached.

Expected results:

The printed document should match the onscreen PDF, since paper size is the same and scale is 100%.

Firefox 82+ is printing the PDF inside the margins used for web pages, and also printing headers and footers, which is a new (and undesired) behavior.

I tried a mozregression (with print.tab_modal.enabled => false) using the Windows GUI, but twice it halted here:

INFO : Narrowed nightly regression window from [2020-09-14, 2020-09-16] (2 days) to [2020-09-15, 2020-09-16] (1 days) (~0 steps left)

Bisecting on mozilla-central [24b91757 - d281ed99]

pushlog_url: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=24b917577203190f0e1c0b21f6ffaf4d07f1e8f6&tochange=d281ed9906a8f0e143239e31a1afad48f6c96617
repo_name: mozilla-central

Found mozilla-central build: a451ebba

app_name: firefox
build_date: 2020-09-16 12:02:43.950000
build_file: C:\Users\redacted.mozilla\mozregression\persist\a451ebba378e-shippable--mozilla-central--target.zip
build_type: integration
build_url: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/c48KKwxLTpCkgCRsZH2H3A/runs/0/artifacts/public%2Fbuild%2Ftarget.zip
changeset: a451ebba378efcce0967e508a8107ab14dd5edcb
repo_name: mozilla-central
repo_url: https://hg.mozilla.org/mozilla-central
task_id: c48KKwxLTpCkgCRsZH2H3A

mozregression doesn't launch that build (for unknown reasons). Perhaps our security software is gumming up the works.

Thanks for the bug report flaviobombonatti, and for the bisection jscher2000!

It looks like this was probably caused by bug 1665001.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Regressed by: 1665001
Summary: Incorrect PDF margins → When printing PDFs are misaligned and clipped in v82 due to extra margins
Whiteboard: [print2020_v82][old-ui+]
Has Regression Range: --- → yes
Component: Untriaged → Printing: Setup
Priority: -- → P1
Product: Firefox → Core

Set release status flags based on info from the regressing bug 1665001

Yeah, this is a regression from bug 1665001.

If there's an @page rule that calls for zero margins, we should absolutely respect that; it means the document has been designed to go fully to the edge of the paper, and likely is intended to fit exactly to the sheet. At that point, it's up to the document author/designer to consider whether some portion at the edges will in fact be unprintable and may get clipped, but we should not subvert their intention by scaling or shifting the output from where they've specified it should go.

I'm actually quite doubtful whether the clamping introduced in bug 1665001 (and in bug 1664227 for margins specified via the UI) is a good idea in general, but that's a broader discussion we may still need to have. But to address this specific case, I think we should at least ensure that margin: 0 in an @page rule will be honored.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED

Comment on attachment 9183173 [details]
Bug 1672529 - Honor page margins of zero when requested by an @page rule. r=jwatt

Beta/Release Uplift Approval Request

  • User impact if declined: PDF documents are misplaced on the paper (and likely clipped) when printing.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: See comment 0.
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Targeted fix that only affects behavior when @page { margin: 0 } is present.
  • String changes made/needed:
Attachment #9183173 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/39fb16bafcdf
Honor page margins of zero when requested by an @page rule. r=jwatt

Comment on attachment 9183173 [details]
Bug 1672529 - Honor page margins of zero when requested by an @page rule. r=jwatt

Taking in 83 beta 3, thanks.

Attachment #9183173 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch

Thank you all for the rapid response.

For Firefox 82, if there is an 82.0.1, perhaps this patch could be taken for that.

Meanwhile, the simplest workaround would be to launch the PDF in the system viewer for printing. (Configuring the printer driver to report zero unwriteable area to applications probably would create problems for all documents other than PDFs.)

Indeed. jfkthame, can you request approval for Release uplift?

Flags: needinfo?(jfkthame)
Summary: When printing PDFs are misaligned and clipped in v82 due to extra margins → When printing, PDFs are misaligned and clipped in v82 due to extra margins
QA Whiteboard: [qa-triaged]

Comment on attachment 9183173 [details]
Bug 1672529 - Honor page margins of zero when requested by an @page rule. r=jwatt

Beta/Release Uplift Approval Request

  • User impact if declined: PDF documents are misplaced on the paper and clipped when printing: regression that badly impacts users trying to print PDFs.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: See comment 0
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Targeted fix that only affects behavior when @page { margin: 0 } is present.
  • String changes made/needed: none
Flags: needinfo?(jfkthame)
Attachment #9183173 - Flags: approval-mozilla-release?

Confirming this issue as verified fixed on 84.0a1 (20201022215159) and 83.0b3(20201022171613). Verified using macOS 10.15.7 but also on Windows 10x64 and Ubuntu 20 just for safe measure.

Status: RESOLVED → VERIFIED
Flags: qe-verify+

Comment on attachment 9183173 [details]
Bug 1672529 - Honor page margins of zero when requested by an @page rule. r=jwatt

approved for 82.0.1

Attachment #9183173 - Flags: approval-mozilla-release? → approval-mozilla-release+

I'm hitting conflicts when grafting to m-r, can you provide a rebased patch?

Flags: needinfo?(jfkthame)

Rebased to mozilla-release (needed because bug 1668406 is not present there).

Flags: needinfo?(jfkthame)

Confirming this issue as verified fixed in 82.0.1(20201026153733). Verified using macOS 10.15.7 and opened in preview as well as performed an actual print, both having the desired behavior.

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

Attachment

General

Created:
Updated:
Size: