Skip to main content

Simple python wrapper for wkhtmltopdf

Project description

python-wkhtmltopdf

A simple python wrapper for the wkhtmltopdf lib (http://code.example.com/p/wkhtmltopdf/) with flash support.

Requirements

System:

  • Xvfd

  • wkhtmltopdf

  • flashplugin-nonfree

  • python 2.5+

Installation

wkhtmltopdf

  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

python-wkhtmltopdf

  1. From git:

    $ git clone git@github.com:qoda/python-wkhtmltopdf.git
    $ cd python-wkhtmltopdf
    $ python setup.py install

Usage

Simple Usage::

  1. Use from class:

    from wkhtmltopdf import WKHtmlToPdf
    
    wkhtmltopdf = WKHtmlToPdf(
        url='http://www.example.com',
        output_file='~/example.pdf',
    )
    wkhtmltopdf.render()
  2. Use from method:

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

    $ python -m wkhtmltopdf.main example.com ~/example.pdf

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 (secs))

  • orientation (default: Portrait)

  • dpi (default: 100)

  • no_background (default: False)

  • grayscale (default: False)

  • http_username (default: None)

  • http_password (default: None)

Authors:

Project details


Download files

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

Source Distribution

wkhtmltopdf-0.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distributions

wkhtmltopdf-0.1-py2.7.egg (11.0 kB view details)

Uploaded Source

wkhtmltopdf-0.1-py2.6.egg (11.0 kB view details)

Uploaded Source

wkhtmltopdf-0.1-py2.5.egg (11.0 kB view details)

Uploaded Source

File details

Details for the file wkhtmltopdf-0.1.tar.gz.

File metadata

  • Download URL: wkhtmltopdf-0.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for wkhtmltopdf-0.1.tar.gz
Algorithm Hash digest
SHA256 8f36d7209a178139c2582d6edd884e865e5c81ed553637e9d128a2c3003cd76b
MD5 51939345866a8c664ee26611351f2854
BLAKE2b-256 3eeebeb56ae5263f5358ac1d4fa060cbfeb462b08bd460d768ddc6fa5034de82

See more details on using hashes here.

File details

Details for the file wkhtmltopdf-0.1-py2.7.egg.

File metadata

File hashes

Hashes for wkhtmltopdf-0.1-py2.7.egg
Algorithm Hash digest
SHA256 b792e805af304341059a68ffc3ab175a39ad8dbf87e193c48da26b41a858dee8
MD5 5a36a20050f3c4fd782df3949c592a26
BLAKE2b-256 b7903ff1228a8ac5972061d1d8a4a6223e04495a6fe0f8ece3dcc3260ca76139

See more details on using hashes here.

File details

Details for the file wkhtmltopdf-0.1-py2.6.egg.

File metadata

File hashes

Hashes for wkhtmltopdf-0.1-py2.6.egg
Algorithm Hash digest
SHA256 83ede785bc9733c36cc4266e27a7f6c499fb7842201f82f73c0475fbf9a51157
MD5 4ab4fbbc7e6bb63f330be7a2f67ebcda
BLAKE2b-256 5bbdd07c0b0752d51ec9898b376b6a64aebd8f0b091403dfbe5e3b70ab2ed0ab

See more details on using hashes here.

File details

Details for the file wkhtmltopdf-0.1-py2.5.egg.

File metadata

File hashes

Hashes for wkhtmltopdf-0.1-py2.5.egg
Algorithm Hash digest
SHA256 8cb6a02643b225b60c9cfe0b70b17ce7f130bcdb66d22719ed475c9775edada0
MD5 b3186cd8e9a0f7258396591d137aa582
BLAKE2b-256 e01ecbbb44ecac189f8d601e8757f957c3175a1944574ec9555ff52dad9df53e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page