Skip to main content

Render a HTML overlay over existing PDF files

Project description

A wrapper for http://weasyprint.org/ which allows compositing with existing PDF files.

API: render(html) Input is a HTML string and output is the PDF bytes.

For weasyprint this needs cairo and cairocffi etc., this adds poppler for reading PDFs. These are best installed via your package manager:

apt install python3-gi-cairo gir1.2-poppler-0.18 python3-cairocffi python3-lxml gir1.2-pango-1.0

It parses the HTML looking for <img> tags with src urls ending “.pdf”. Each one begins a new page and copies all source pages overlaying the weasyprint output. The magic value “blank.pdf” outputs sections HTML without overlaying.

python -m htmloverpdf < test.html > test.pdf

Project details


Download files

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

Files for htmloverpdf, version 0.0.1b2
Filename, size File type Python version Upload date Hashes
Filename, size htmloverpdf-0.0.1b2-py3-none-any.whl (4.2 kB) File type Wheel Python version 3.5 Upload date Hashes View
Filename, size htmloverpdf-0.0.1b2.tar.gz (2.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page