WeasyPrint 0.19 depends on:
Python, cairo, Pango and GDK-PixBuf need to be installed separately. See platform-specific instructions below.
CFFI and lxml can be installed by pip automatically if your system has a C compiler and the recursive dependencies, but using a system package might be easier.
virtualenv --system-site-packages ./venv . ./venv/bin/activate pip install WeasyPrint
Now let’s try it:
weasyprint --help weasyprint http://weasyprint.org ./weasyprint-website.pdf
You should see warnings about unsupported CSS 3 stuff; this is expected. In the PDF you should see the WeasyPrint logo on the first page.
You can also play with WeasyPrint Navigator:
python -m weasyprint.navigator
|||cairo ≥ 1.12 is best but older versions should work too. The test suite passes on cairo 1.8 and 1.10 with some tests marked as “expected failures” due to behavior changes or bugs in cairo.|
|||Without it, PNG and SVG are the only supported image format: JPEG, GIF and others are not available. Versions before 0.22 were part of GTK+.|
|||Passing the --system-site-packages option to virtualenv allows the environment to use the system packages for lxml or CFFI, but this is not necessary if you install them with pip.|
Pango, GdkPixbuf, and cairo can not be installed with pip and need to be installed from your platform’s packages. lxml and CFFI can, but you’d still need their own dependencies. This section lists system packages for lxml or CFFI when available, the dependencies otherwise. lxml needs libxml2 and libxslt, CFFI needs libffi. On Debian, the package names with development files are libxml2-dev, libxslt1-dev and libffi-dev.
If your favorite system is not listed here but you know the package names, tell us so we can add it here.
Debian 7.0 Wheezy or newer, Ubuntu 11.10 Oneiric or newer:
sudo apt-get install python-dev python-pip python-lxml libcairo2 libpango1.0-0 libgdk-pixbuf2.0-0 libffi-dev
Debian 6.0 Squeeze, Ubuntu 10.04 Lucid: GDK-PixBuf is part of GTK+, which also depends on cairo and Pango.
sudo apt-get install python-dev python-pip python-lxml libgtk2.0-0 libffi-dev
sudo yum install python-devel python-pip python-lxml cairo pango gdk-pixbuf2 libffi-devel
sudo pacman -S python-pip python-lxml cairo pango gdk-pixbuf2
sudo port install py27-pip py27-lxml cairo pango gdk-pixbuf2 libffi
brew install python cairo pango gdk-pixbuf libxml2 libxslt libffi