- Ubuntu
- Package management
- here
Install wkhtmltopdf-convert HTML to PDF
I will explain how to install wkhtmltopdf. Install wkhtmltopdf using the apt command. Run with administrator privileges using sudo.
sudo apt install -y wkhtmltopdf
Confirmation of installation of wkhtmltopdf
Make sure the wkhtmltopdf command is available.
wkhtmltopdf
What is wkhtmltopdf?
wkhtmltopdf is a tool for converting HTML to PDF. Converts the result rendered by the rendering engine Webkit to PDF.
wkhtmltopdf can be used to create PDF forms. It is convenient to convert a form made of HTML that is published for free on the Web to PDF.
The generated PDF does not reach the quality of the book, but I think it can be used for the production of vocational school textbooks and doujinshi.
Fixed a bug that wkhtmltopdf cannot be executed
It seems that X Server or Qt is required for PDF generation of wkhtmltopdf, but there is a bug that can not be executed if the old Qt is not patched.
QXcbConnection: Could not connect to display
One way to solve this seems to be to install wkhtmltopdf, which utilizes patched Qt. This may not be a formal means.
cd ~ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz tar vxf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz mkdir -p / usr / local / bin sudo cp wkhtmltox / bin / wk * / usr / local / bin /
$/ usr / local / bin / wkhtmltopdf --version
wkhtmltopdf 0.12.3 (with patched qt)
Solution when wkhtmltopdf shows SSL error Check on Ubuntu 18
Solution if wkhtmltopdf shows SSL error.
Exit with code 1 due to network error: UnknownNetworkError QSslSocket: cannot call unresolved function CRYPTO_num_locks QSslSocket: cannot call unresolved function CRYPTO_set_id_callback QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
Installing the following packages solved the problem.
sudo apt install libssl1.0-dev
If Japanese cannot be displayed with wkhtmltopdf
If Japanese cannot be displayed with wkhtmltopdf If it looks like "□□□", please install the Japanese font.
To solve this, the procedure to install the latest version of wkhtmltopdf on Ubuntu 18 is published, so I will write it here.Install wkhtmltopdf 0.12.6 on Ubuntu 18.
Installing 0.12.6 on Ubuntu 18.
Then I upgraded to 0.12.6 and fixed the issues found in 0.12.4 and 0.12.5.
The updated installation procedure is as follows:
Check the version you are currently using, if any.
$wkhtmltopdf --version
wkhtmltopdf 0.12.3 (with patched qt)
Delete the existing version by finding and deleting all the files in "wkhtml".
sudo find / -name * wkhtml *
Delete "wkhtmltopdf" and "wkhtmltox" related files.
Download the version 0.12.6 .deb package.
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
Install the .deb package.
sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
If you get the error that the dependency is missing, use "sudo apt install -f" to install the dependency.
Make sure the correct version is installed and accessible.
$wkhtmltopdf --version
wkhtmltopdf 0.12.6 (with patched qt)
->