使用系统是ubuntu 16
第一部分:
首先是imgkt的安装:
pip install imgkit
然后是wkhtmltopdf的安装,不要使用 apt-get安装!!因为apt-get安装的是一个阉割版!在文档中有写道:
Warning! Version in debian/ubuntu repos have reduced functionality (because it compiled without the wkhtmltopdf QT patches), such as adding outlines, headers, footers, TOC etc. To use this options you should install static binary from wkhtmltopdf site or you can use this script.
正确的使用方式是创建 init.sh文件,将以下内容拷贝进去:
#!/usr/bin/env bash
sudo apt-get install -y openssl build-essential xorg libssl-dev xvfb
pip install coverage
wget https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cd wkhtmltox
sudo chown root:root bin/wkhtmltopdf
sudo cp -r * /usr/