Linux uses the Wkhtmltopdf tool to convert HTML to PDF format documents

888u

Last update at :2024-06-16,Edit by888u

The company's work documents need to be converted from HTML format to PDF document backup. There are many online tools available on the Internet, but most of the tools are somewhat limited and have too many advertisements. When looking for tools, I saw that the Wkhtmltopdf tool can be used directly on Linux. To install and use, Wkhtmltopdf is an open source component that generates PDF from web pages using webkit browser.

According to the introduction, Wkhtmltopdf has Windows and Linux versions. Here, Snail directly installs and converts it in the CentOS system to see the effect.

First, Wkhtmltopdf download

A – 64-bit

wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz

B – 32-bit

wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-i386.tar.xz

Second, decompress and install

A – 64-bit

tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz

B -32 bit

tar -xvzf wkhtmltox-0.12.4_linux-generic-i386.tar.xz

Unzip it according to the version we downloaded.

cp wkhtmltox/bin/wkhtmltopdf /usr/bin/

Copy the program to the /usr/bin/ directory so that it can be executed in any directory.

Third, how to use Wkhtmltopdf

wkhtmltopdf http://www.wpbeginner.com/plugins/7-best-wordpress-backup-plugins-compared-pros-and-cons/ 7-best-wordpress-backup.pdf

Here the snail finds a page at random, and then sets the HTML page and PDF document that need to be converted.

After the execution is completed, we can see the converted PDF document in the current directory, which can be downloaded and opened locally.

Recommended site search: Ministry of Industry and Information Technology ICP registration number, how to query domain name registration number, PHP space application, virtual host space, telecommunications server, Chengdu virtual host, US server rental, dynamic IP vps, Japanese proxy server IP, foreign server,

Linux uses the Wkhtmltopdf tool to convert HTML to PDF format documents

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码