Bug 1407238

Cli argument for print page or generate pdf command in Firefox headless mode

UNCONFIRMED
Unassigned

Status

()

defect
P3
normal
UNCONFIRMED
2 years ago
4 months ago

People

(Reporter: murznn, Unassigned)

Tracking

57 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Reporter

Description

2 years ago
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170828095647

Steps to reproduce:

Please add command line argument for print page (or export to PDF) in Firefox headless mode, like 'screenshot' function. Printing and generating pdf are more useful that pixelized screenshot.
Reporter

Comment 1

2 years ago
Google Chrome already have command for generate PDF: https://developers.google.com/web/updates/2017/04/headless-chrome
chrome --headless --disable-gpu --print-to-pdf https://bugzilla.mozilla.org
Reporter

Comment 2

2 years ago
Here https://addons.mozilla.org/en-US/firefox/addon/cmdlnprint/ is addon for printing in Firefox from command line, but it isn't work on fresh Firefox versions.
Component: Untriaged → Headless
Priority: -- → P3

Comment 3

2 years ago
Suggestion: this should also use "@media print" for the CSS rules.
(That's what all the other tools: chromium, wkhtmltopdf, phantomjs, slimerjs do]

Comment 4

Last year
Oooh this would definitely be a nice to have.
The problem is that of IE, Firefox and Chrome, chrome was definitely in last place when it came to PDF generation.

(IE did a bit better than Firefox when it came to layout it seemed, at least on the Windows machines we had to support but Firefox was close second)

Chrome's main fail is multi-page tables with page-break-before rules inside the table to ensure sections were on same page.  Or just sane rendering of thead period.  It would overlap content and other absurdities.  Ended up hacking in fragile multi-table fragmentation of long tables just to get something chrome could manage to print.

Firefox' long-standing print fail has been iframes, but that's rarely an issue with the kind of documents I'd need to export to PDF, and is much much more easily worked around in a JS iframe remover.

So, yeah, if I had a headless Firefox option it would be a lovely replacement for all the other ones mentioned here which rely on webkit.

Comment 5

4 months ago

This would be really useful. I've built a little app to help me test CSS fragmentation properties, which I have up and running with Puppeteer and also wkhtmltopdf. I had hoped I'd be able to take a similar approach to that of Puppeteer with headless firefox.

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