Earlier quoted context omitted.
Latex is free.
Really not the same thing (e.g. pandoc for html -> pdf via LaTeX) as having a webkit based renderer. They do not look the same at all; sometimes it is good to have a LaTeX output but most of the time you are going to want a more accurate representation of your HTML.
Firefox 56 supports headless mode on Windows
51–60 of 88 posts
Re: Firefox 56 supports headless mode on Windows
#52Re: Firefox 56 supports headless mode on Windows
#53Earlier quoted context omitted.
We use wkhtmltopdf to do this server side. It as a few problems and quirks, but it work well enough for us.
it has a lot of quirks, and, frankly, webkit is pretty bad at printing in general as it lacks a ton of printing specific features like re-printing table headers across page boundaries. There's also only very rudimentary support for page headers and footers. wkhtmktopdf is probably ok if you just need a quick single page invoice printout, but the moment you need more (in our case, we definitely do), I can highly recom…
We wanted the same view to be passed into wkhtmltopdf to download it as PDF (with a couple of things omitted).
Unfortunately, the JS didn't execute properly, so you get a borked output.
End result was we render it, capture the HTML after render, and pipe that through to wkhtmltopdf.
Using chrome _should_ resolve that issue and let us just pass the page through.
Re: Firefox 56 supports headless mode on Windows
#54I was wondering if I could use this (using a plugin) or Chrome to generate PDF files on the web server. Most of the PDF generation software out there are quite expensive.
You can. In my experience, there are very few systems as good at producing accurate renders as well as Chrome. There are a few Chrome/webkit based options. PhantomJS made the process pretty easy, but that's probably not a good option these days as it's on the way out. NightmareJS is pretty much the same and can do it (though I haven't tested myself) [0] If you want to get a little deeper you can use CEF (Chromium Emb…
Re: Firefox 56 supports headless mode on Windows
#55I was wondering if I could use this (using a plugin) or Chrome to generate PDF files on the web server. Most of the PDF generation software out there are quite expensive.
Re: Firefox 56 supports headless mode on Windows
#56It's not very clear how to actually use this in a test environment like Selenium etc. At least with headless Chrome there are libraries now to drive it via the remote debug protocol like https://github.com/LucianoGanga/simple-headless-chrome This feels a little nicer than Selenium as it's one less layer of abstraction. EDIT: guess from other comments WebDriver is the right method to access.
I would imagine the same approach could be used here with minimal changes.
Re: Firefox 56 supports headless mode on Windows
#57It's not very clear how to actually use this in a test environment like Selenium etc. At least with headless Chrome there are libraries now to drive it via the remote debug protocol like https://github.com/LucianoGanga/simple-headless-chrome This feels a little nicer than Selenium as it's one less layer of abstraction. EDIT: guess from other comments WebDriver is the right method to access.
It should be mentioned that this is an area of active development. I don't believe headless mode has been "officially" announced yet; documentation should follow when that happens. Optimization, more APIs, more platforms, and easy deployment are in the pipeline. The meta bug for tracking is here: https://bugzilla.mozilla.org/show_bug.cgi?id=1338004
(Disclaimer: I'm an intern at Mozilla, working with 'brendandahl on headless right now.)
Re: Firefox 56 supports headless mode on Windows
#58It's not very clear how to actually use this in a test environment like Selenium etc. At least with headless Chrome there are libraries now to drive it via the remote debug protocol like https://github.com/LucianoGanga/simple-headless-chrome This feels a little nicer than Selenium as it's one less layer of abstraction. EDIT: guess from other comments WebDriver is the right method to access.
The Chrome Devtools API is really useful. However, if you're wanting to use Selenium, a coworker of mine wrote this up to show how to use headless Chrome with Python + Selenium https://duo.com/blog/driving-headless-chrome-with-python I would imagine the same approach could be used here with minimal changes.
Re: Firefox 56 supports headless mode on Windows
#59Earlier quoted context omitted.
The Chrome Devtools API is really useful. However, if you're wanting to use Selenium, a coworker of mine wrote this up to show how to use headless Chrome with Python + Selenium https://duo.com/blog/driving-headless-chrome-with-python I would imagine the same approach could be used here with minimal changes.
Would people find it helpful if I add a `headless` capability to `moz:firefoxOptions` in geckodriver so that passing in `{capabilities: {alwaysMatch: {moz:firefoxOptions:{headless: true}}}}` when starting a session will start the browser in headless mode, if supported? This doesn't seem like something that's compelex enough to warrant a whole blogpost to explain how to get it working.
Re: Firefox 56 supports headless mode on Windows
#60"headless" Poke me when there are no X11/Qt/GTK/whatever dependencies at all - that is headless. https://packages.debian.org/stretch/firefox-esr