Skip to main content

Python source to pdf conversion library.

Project description


py2pdf has one simple purpose: It takes a unicode string with python source code and creates a nice looking pdf file. The library is simple and self-contained. All pdf generation is done by py2pdf itself. No font files are needed.

Quick example

>>> import py2pdf
>>> text = open('').read().decode('latin-1')
>>> f = open('tmp.pdf', 'wb')
>>> py2pdf.create_pdf(
...    text, f,
...    title='py2pdf',
...    pagesize=py2pdf.A4,
...    printed_by='Printed by ME',
...    file_date='2020-08-01')
>>> py2pdf.startfile('tmp.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 py2pdf, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size py2pdf-0.1.1.tar.gz (6.2 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