Show HN: Athena, drop-in replacement for wkhtmltopdf using Docker, Electron and Go
athenapdf.com
athenapdf.com
Switching to Blink is obvious, but which wrapper to use (CEF, Electron, etc) is hard to decide. Because they all use a multi process architecture, supporting the API around which the tools are built is not really possible. Time to work on it has also been in short supply in recent times.
So, good work by the authors. Wish we could get something better, but as long as browsers move at the pace they do, it's going to be tough.
Because until that happens, the only way I can run docker images is when I've created them myself... and even then I really need a tool that does the above, so that I can rebuild them when the next CVE comes around.
I think this is actually a great use of Docker.
I get that it's hard to convert web elements (via Chrome) to a readable/nice PDF, but wkhtmltopdf really isn't the miracle tool it is made out to be. Like you, I have to tweak the options majorly, and even then it fails to support proper page breaks between text lines (i.e. a line of text that is cut across a page break looks so unprofessional).
We are in need of a true web to PDF conversion tool; it's one of those things that is overlooked in the business sector but represents quite a valuable niche.
"Aggressive mode", which leverages Chromium's "simplify page" mode, might do some of what you want, but typically you need some of the funky print css classes to enforce widows/orphans.
The main reason we have built this however is that wkhtmltopdf just crashes all the time. Other commenters seem to agree. We'd love feedback on whether Athena works in cases that other tools fail, as well as on quality of conversion.
Except when doing multiple pages and multiple table, footers and headers, splitting tables correctly. Ow yeah, and the difference with local files between windows and linux.
That's about it :)
PS. I use it to create invoices, there aren't a lot of alternatives for it though. So i'm happy it's here! I don't think it's an easy problem to solve..
Here's what my code looks like: http://pastebin.com/KB15Q6GM
I'm only really using --disable-internal-links and --no-outline, but sometimes I force a stylesheet.
Typical use would be `makepdf -o URL`. This saves the PDF in a temp folder, opens it to preview, then asks to save. If it encounters any fatal errors, it iterates through the available `wkhtmltopdf` binaries on PATH (I've got a couple) until it finds the first one that works.
Then there are a few options that can be added (ignore, lowquality, disable-javascript) and it will feed the appropriate option string for that version of `wkhtmltopdf` (since option strings may vary by version).
wkhtmltopdf uses a WebKit browser to print HTML to PDF.
Replacing one package with three is nothing to be proud of. Replacing one with 13 plus wrapper code [1] is utterly ridiculous.
I don't know the background of this project, so there may be some important detail I'm missing, but it seems they would have done better to set up a stable wkhtmltopdf Dockerfile microservice instead, and avoid all of the wrapper code entirely. Cool as a demo of what's possible with tech today; less cool as a demo of how many hoops you can jump through to reproduce existing functionality.
[1] https://github.com/arachnys/athenapdf/blob/master/cli/Docker...