ubuntu22.04 安装 wkhtmltopdf

#安装字体
apt-get install fontconfig libxrender1 xfonts-75dpi xfonts-base
#下载源码包
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb

#检测安装是否成功
wkhtmltopdf --version
wkhtmltoimage --version

centos安装wkhtmltopdf

#centos7
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
sudo yum localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rpm
#centos8
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos8.x86_64.rpm
sudo dnf localinstall wkhtmltox-0.12.6-1.centos8.x86_64.rpm

debian安装

https://github.com/wkhtmltopdf/packaging/releases

apt-get update
先安装控件
apt-get install  fontconfig libxrender1 xfonts-75dpi xfonts-base -y
apt-get install  libxext6 libjpeg62-turbo -y  #debian12需补控件

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.bullseye_amd64.deb
debian12
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb
安装
dpkg -i wkhtmltox_0.12.6-1.buster_amd64.deb
dpkg -i wkhtmltox_0.12.6.1-2.bullseye_amd64.deb
dpkg -i wkhtmltox_0.12.6.1-3.bookworm_amd64.deb



#查看
wkhtmltopdf

#软件的默认安装位置
/usr/local/bin/wkhtmltopdf

测试转码

wkhtmltopdf --orientation Landscape  a.html a.pdf