Closed Bug 1617549 Opened 4 years ago Closed 1 year ago

Page.printToPDF ends up adding extra margins to the document

Categories

(Remote Protocol :: CDP, defect, P3)

defect

Tracking

(firefox114 fixed)

RESOLVED FIXED
114 Branch
Tracking Status
firefox114 --- fixed

People

(Reporter: whimboo, Assigned: victoria.o.ajala, Mentored)

References

Details

(Whiteboard: [lang=js])

User Story

To get started with working on the Remote Protocol check out: https://firefox-source-docs.mozilla.org/remote/index.html

Attachments

(1 file)

(In reply to James Graham [:jgraham] from bug 1616932 comment #0)

Gecko has the concept of the unprintable area, which is effectively a system-specific additional margin added to printed documents by default. I don't think it makes sense to add this to documents generated with the marionette print command since PDFs don't have an unprintable region, and authors should expect the margin to be what they specify and not depend on some other system settings.

We also have to add those preferences to the print to PDF feature of our CDP implementation here:

https://searchfox.org/mozilla-central/rev/a37fc61f172b432e7ae0b6b4c4a12cac2a787a0f/remote/domains/parent/Page.jsm#487

Component: CDP: Page → CDP
Severity: normal → S3

(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #1)

Tt means that the referenced code above would require print settings like:
https://searchfox.org/mozilla-central/rev/26790fecfcda622dab234b28859da721b80f3a35/remote/shared/PDF.sys.mjs#120-124

Hello, Can you elaborate on this please?

According to my understanding, the print settings referenced in mozilla-central/remote/shared/PDF.sys.mjs should be added to mozilla-central/remote/domains/parent/Page.jsm to print to PDF feature of the CDP implementation If I'm correct

If you compare the settings between both protocols you will notice that the unwritable margins settings are missing for CDP. Exactly those are needed and have to be added.

Okay, I would attach a patch for this soon

Assignee: nobody → victoria.o.ajala
Status: NEW → ASSIGNED
Attachment #9329971 - Attachment description: Bug 1617549 - Added unwritable margin print settings for CDP. r=whimboo → Bug 1617549 - [CDP] Added unwritable margin print settings.
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2c30b40959f8
[CDP] Added unwritable margin print settings. r=whimboo,webdriver-reviewers
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: