Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Simple python wrapper for wkhtmltopdf

Project Description


A simple python wrapper for the wkhtmltopdf lib ( with flash support.



  • Xvfd
  • wkhtmltopdf
  • flashplugin-nonfree
  • python 2.5+



  1. Install Xvfd:

    $ sudo apt-get install xvfb
  2. Install Fonts:

    $ sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
  3. Install wkhtmltopdf:

    $ sudo apt-get install wkhtmltopdf
  4. Install flashplugin:

    $ sudo apt-get install flashplugin-nonfree


  1. From git:

    $ git clone
    $ cd python-wkhtmltopdf
    $ python install


Simple Usage::

  1. Use from class:

    from wkhtmltopdf import WKHtmlToPdf
    wkhtmltopdf = WKHtmlToPdf(
  2. Use from method:

    from wkhtmltopdf import wkhtmltopdf
    wkhtmltopdf(url='', output_file='~/example.pdf')
  3. Use from commandline (installed):

    $ python -m wkhtmltopdf.main ~/example.pdf
  4. Use the api (installed):

    $ python -m wkhtmltopdf.api &
    $ wget http://localhost:8888/?

Required Arguments:

  • url - the url to convert to pdf
  • output_file - the pdf file that you want to create

Optional Arguments:

  • screen_resolution (default: [1024, 768])
  • color_depth (default: 24 (bit))
  • flash_plugin (default: True)
  • disable_javascript (default: False)
  • delay (default: 0 (millisecs))
  • orientation (default: Portrait)
  • dpi (default: 100)
  • no_background (default: False)
  • grayscale (default: False)
  • http_username (default: None)
  • http_password (default: None)
  • header_html (default: None)
  • footer_html (default: None)


Release History

Release History

This version
History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
wkhtmltopdf-0.2-py2.5.egg (12.4 kB) Copy SHA256 Checksum SHA256 2.5 Egg Jul 21, 2011
wkhtmltopdf-0.2-py2.6.egg (12.4 kB) Copy SHA256 Checksum SHA256 2.6 Egg Jul 21, 2011
wkhtmltopdf-0.2-py2.7.egg (12.4 kB) Copy SHA256 Checksum SHA256 2.7 Egg Jul 21, 2011
wkhtmltopdf-0.2.tar.gz (9.7 kB) Copy SHA256 Checksum SHA256 Source Jul 21, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting