Installation

This is a typical Python library and is installed using pip

pip install xhtml2pdf

To obtain the latest experimental version that has Python 3 support, please use a prerelease

pip install --pre xhtml2pdf

Requirements

Python 2.7+. Only Python 3.4+ is tested and guaranteed to work.

All additional requirements are listed in requirements.txt file and are installed automatically using the pip install xhtml2pdf method.

Development environment

  1. If you don’t have it, install pip, the python package installer

    sudo easy_install pip
    

    For more information about pip refer to http://www.pip-installer.org/.

  2. I will recommend using virtualenv for development. This is great to have separate environment for each project, keeping the dependencies for multiple projects separated

    sudo pip install virtualenv
    

    For more information about virtualenv refer to http://www.virtualenv.org/

  3. Create virtualenv for the project. This can be inside the project directory, but cannot be under version control

    virtualenv --distribute xhtml2pdfenv --python=python2
    
  4. Activate your virtualenv

    source xhtml2pdfenv/bin/activate
    

    Later to deactivate use

    deactivate
    
  5. Next step will be to install/upgrade dependencies from requirements.txt file

    pip install -r requirements.txt
    
  6. Run tests to check your configuration

    nosetests --with-coverage
    

    You should have a log with success status:

    Ran 36 tests in 0.322s
    
    OK