I'm trying to generate a pdf file from html and would like to know the best way. I've tried html-pdf, pdf-puppeteer, node-wkhtmltopdf.
The first 2 crash the server when used giving 0 errors on a Digital Ocean Droplet using an Ubuntu image. They work fine on my computer (MAC OS), but fail to where on the server. When I tried node-wkhtmltopdf, which looked promising:
var wkhtmltopdf = require('wkhtmltopdf');
wkhtmltopdf(html).pipe(res);
It crashed giving an error message: >
Error: qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display
I would like to know the best way I can create pdfs using a Digital Ocean Droplet.
Found the solution, the qt is broken for the version which is installed using 'apt-get install' on ubuntu.
So, I installed wkhtmltopdf from the git repository and it worked fine.