Closed Bug 1617549 Opened 4 years ago Closed 5 months ago

Page.printToPDF ends up adding extra margins to the document


(Remote Protocol :: CDP, defect, P3)



(firefox114 fixed)

114 Branch
Tracking Status
firefox114 --- fixed


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


(Blocks 1 open bug)


(Whiteboard: [lang=js])

User Story

To get started with working on the Remote Protocol check out:


(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:

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:

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
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
[CDP] Added unwritable margin print settings. r=whimboo,webdriver-reviewers
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
You need to log in before you can comment on or make changes to this bug.