This repository has been archived by the owner. It is now read-only.
A Python package that converts web pages to PDFs.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
h2p
tests
.bumpversion.cfg
.codeclimate.yml
.gitignore
.travis.yml
LICENSE
MANIFEST.in
Pipfile
Pipfile.lock
README.md
setup.cfg
setup.py

README.md

h2p

Build Status Test Coverage Maintainability

This package converts HTML pages to PDFs by leveraging libwkhtmltox via ctypes, avoiding the need to spawn subprocesses on every call.

Installation

pipenv install h2p

Usage

Make sure libwkhtmltox.0.12 is on your library path.

from h2p import generate_pdf

# PDFs are built on a background thread so each call to
# generate_pdf is asynchronous.
task = generate_pdf("output.pdf", source_uri="http://example.com")

# result blocks until a task has finished.  If an error occurred
# this will raise a ConversionError.
task.result()

See help(generate_pdf) for info on the available parameters.

License

h2p is licensed under Apache 2.0. Please see LICENSE for licensing details.