Elixir PDF Generator Failed to Render the String of HTML

Hi, I have a problem when creating PDF using elixir-pdf-generator from this library GitHub - gutschilla/elixir-pdf-generator: Create PDFs with wkhtmltopdf or puppeteer/chromium from Elixir.

Basically I already followed all the instruction and use the wkhtmltopdf. When I tried to create it using the example.

PdfGenerator.generate {:url, "http://google.com"}, page_size: "A5"

What I get is a PDF that is the page of google but all the string are blank (failed to render)

Can anyone help me? I’m currently stuck here

This also happened when I create using the html stirng from my local device.

1 Like

Wild guess: missing font?

Not really on topic, but:

Last time I looked into it, wkhtmltopdf didn’t look like a healthy project very much: still using ancient QtWebkit, not much development happening, etc. They have a pretty good writeup on the library’s status on their homepage https://wkhtmltopdf.org/status.html#summary, which didn’t exactly makes you want to start using it for new projects either. I can only recommend switching to a recent Chrome/Chromium as your rendering engine, if you can. There are a few libraries in Elixir-land that have support for it, and it might solve your rendering issues as well.

2 Likes

This seems fantastic.

2 Likes

This blog post gives a little more insight on different PDF printers from a performance perspective:

It seems that ChromicPDF is up to 60 times faster for small PDFs than pdf_generator (and even faster compared to pupeteer_pdf).

1 Like