安裝測試
方式一:
官網下載安裝包 wkhtmltox-0.12.5-1.centos7.x86_64.rpm
https://wkhtmltopdf.org/
Linux 本地安裝 yum localinstall wkhtmltox-0.12.5-1.centos7.x86_64.rpm
測試是否安裝成功
wkhtmltopdf http://www.baidu.com /data1/baidu.pdf
pdf 中文不顯示問題:
打開windows c:\Windows\fonts\simsun.ttc拷貝到linux服務器/usr/share/fonts/目錄下,
方式二
下載包
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
解壓
tar xvfJ wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
進入解壓包目錄
cd wkhtmltox/bin
創建快捷方式
sudo mv ./wkhtmltopdf /usr/bin/wkhtmltopdf
sudo chmod +x /usr/bin/wkhtmltopdf
安裝依賴包
yum install libXrender*
linux wkhtmltopdf 執行 ./wkhtmltopdf --version 報錯
./wkhtmltopdf: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or directory,執行 apt-get/yum install libXrender*
運行 wkhtmltopdf 報wkhtmltopdf: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory這個錯,請運行apt-get/yum install libfontconfig*
運行 wkhtmltopdf 報wkhtmltopdf: error while loading shared libraries: libXext.so.6: cannot open shared object file: No such file or directory這個錯,請運行 apt-get/yum install libXext*