A Python 2 client library for the Pdfcrowd HTML to PDF API
Python Makefile
Latest commit 13eac29 Mar 19, 2017 pdfcrowd dev updated test URL
Permalink
Failed to load latest commit information.
.gitignore
CHANGELOG updated CHANGELOG Nov 13, 2015
README.md Updated Readme.md Nov 13, 2015
makefile added the init target and updated the clean target Mar 1, 2013
pdfcrowd.py version bump to 2.7 Nov 13, 2015
setup.py version bump to 2.7 Nov 13, 2015
tests.py updated test URL Mar 19, 2017

README.md

Pdfcrowd HTML to PDF API client

The Pdfcrowd API lets you easily create PDF from web pages or raw HTML code in your Python 2.x applications.

To use the API, you need an account on http://pdfcrowd.com, if you don't have one you can sign up here. This will give you a username and an API key.

Installation

The package can be retrieved from pypi. You can install it with pip/easy_install:

pip install pdfcrowd

Or you can download/clone the client and run

git clone https://github.com/pdfcrowd/pdfcrowd-python.git    
cd pdfcrowd-python/
python setup.py install

Example

(don't forget to use your "username" and "apikey")

import pdfcrowd

try:
    # create an API client instance
    client = pdfcrowd.Client("username", "apikey")

    # convert a web page and store the generated PDF into a pdf variable
    pdf = client.convertURI('http://example.com')

    # convert an HTML string and save the result to a file
    html="<html><body>In-memory HTML.</body></html>"
    client.convertHtml(html, open('html.pdf', 'wb'))

    # convert an HTML file
    client.convertFile('/path/to/local/file.html', open('file.pdf', 'wb'))

except pdfcrowd.Error, why:
    print 'Failed:', why

Links

Python 3.x version: https://github.com/pdfcrowd/pdfcrowd-python3

API Home: https://pdfcrowd.com/html-to-pdf-api/

API Reference: https://pdfcrowd.com/web-html-to-pdf-python/