Open amafehr opened 4 weeks ago
I'm working to implement js's html-to-browser
this week to remove the chromium dependency. Otherwise, install instructions are up-tp-date to reflect current installs needed.
Womp womp, it didn't work out. See notes above.
Summary
Most tools that do this either have many dependencies or rely on a browser driver (slow performance, potentially some browser issues). We would like to find some middle ground tool if it exists.
Details
This has to be lightweight; many options open a headless browser reliant on a browser driver (e.g. selenium uses the Chrome driver) which takes a few seconds per conversion (see posted issue for follow-up on this separately). We explored numerous options that do not seem possible, so this area remains a task anyone is free to take on. Specifically, we tried
pandoc
,weasyprint
, node.jshtml-to-pdf
, and a less restrictive DOMlinkedom
.pandoc
: would have been a good option but had many texlive (latex universe) and system dependencies that ultimately did not work out.weasyprint
: we think it could work but may require some tinkering with the CSS elements in the HTML plot template. Library logging showed weasyprint fails to render SVG image and an option wasn't apparent.linkedom
: As with the current DOM (jsdom
), a richer browser was required (headless browser to render styles and flexboxes), makinghtml-to-pdf
a non-option.TODO
generate_svg
.Options (non-exhaustive) and what we know
wkhtmltopdf
is a common dependency many Python libraries wrap that homebrew is deprecating (2024)--this could prevent a future difficulty for install.imgkit
is a wrapper around this library.