Install wkHTMLtoPDF on 1und1/ionos Managed Server
A client of mine relies heavily on creating pdf from html documents, server-side.
Now, creating complex pdf on the server is a task that lets you age 20 years, if you don't run a root server or use a third party service uploading sensitive data to a foreign server (and deal with GDPR issues and latency).
Creating pdf via php is either super expensive1 or a pain in the ass2. Or you can install the Python based WeasyPrint3, a headless Chrome4 or wkHTMLtoPDF which I was able to setup on an 1und1/ionos managed server environment (using the static linux version of wkhtmltopdf).
Unfortunately wkHTMLtoPDF version 0.12.4 - the last static version (which I believe is supposed to include all dependencies) stopped working after 1und1/ionos updated their servers to a new Debian version.
The error is caused by an updated OpenSSL library in Debian 10 and I have no idea what it all means, just that html files with references to
https:// resources are not loaded anymore and therefore the PDF is generated without images and styles, which is not good.
Talking to the support they didn't give me much hope with installing third party software on a managed server and told me stories about Typo3 CMS that stopped working because of some updated crypto libraries.
That made me feel good to never put my money on Typo3 and on very specific software setting. I always try to have as less technical debt as possible and websites should run on the cheapest shared host, if possible.
With PDF it's difficult and I started thinking about renting a small Virtual Private Server and setting up a PDF service for that purpose, with all the technical debt that comes with it.
But then the Mail from 1und1/ionos technical support came with the following instructions:
Connect via SSH to the server (https://www.ionos.de/hilfe/index.php?id=2923)
Download the correct version (in my case):
- Execute the following statements:
ar vx wkhtmltox_0.12.6-1.buster_amd64.deb
which should result in the following folders/files:
debian-binary control.tar.gz data.tar.xz
tar xf data.tar.xz
- Check if everything work:
./usr/local/bin/wkhtmltopdf 'https://google.de' google.pdf
The executable is accessible here:
/kunden/homepages/xx/d123456789/htdocs/usr/local/bin/wkhtmltopdf and if you use KnpLabs/snappy or call the executable directly, that should work again.