-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for chrome (and chromium) as PDF engines #7261
Comments
Maybe a counter-argument, taken from chrome's man page:
But this has been supported now for 4 years, so it appears to be reasonably stable. |
Closing again, because making the PDF look reasonably nice seems to be non-trivial, see, e.g., the chrome-headless-render-pdf npm package. Maybe adding support for a wrapper like Sorry for the noise. |
I've been wondering about this as well! And I'm still a bit surprised that there's no official (or at least commonly used) command-line wrapper around that use-case of chromium (analogous to wkhtmltopdf). The closest thing I could find was puppeteer-cli, which is a wrapper around puppeteer. Puppeteer is a node.js package and seems to be the most commonly used way to access Chromium over the DevTools Protocol, and seems to be fairly stable (i think it's even developed by Google itself). We could of course also try to call the devtools protocol directly from Haskell, but probably not the right approach. I'd rather just add another Note that pagedjs, is a different beast. It's a JavaScript library, meant to run in a browser, that's basically a polyfill for CSS specs for paged media that so far no browser has implemented yet thoroughly. (I've added it to PanWriter for the paginated preview and it works 'okay'...) Quick search turned up this blog post which says much of the same things. |
There is a also a
I tried it on the manual, and as you say, it's not perfect but quite nice already. |
Right, so while puppeteer-cli runs chromium directly on the input html/css, pagedjs-cli also injects the paged.js javascript and puts in divs etc. to do the pagination, before running chromium on it... Neither package seems to have gained much adoption (yet), so it's a bit hard to justify adding either one to pandoc as a |
I just found #6126, which is probably a better placeholder than this issue. I'll add a comment about pagedjs there. |
The Chrome and Chromium web browsers support printing of websites through the command line, e.g.
It would be nice if pandoc allowed to generate PDFs through HTML by having
chrome
andchromium
available as PDF engines.There isn't much documentation on command line options, but the devtools interface has many more options. Maybe we can make use of them somehow. https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF
The text was updated successfully, but these errors were encountered: