Skip to main content

A python package to create PDF files.

Project description


Python library to create PDF


  • Basic page addition (with support of multiple formats)
  • Basic text writing
  • TrueType font embedding (including propper font subsetting)
  • EAN13 barcode insertion


Use pip3for the installation of PaPDF:

pip3 install PaPDF

Simple usage example:

The following snippet will create a pdf (test.pdf) with two pages and two texts.

import PaPDF
with PaPDF("test.pdf") as pdf:
    pdf.addText(40, 290, "Hello world")
    pdf.addText(40, 10, 'Hello world')

TrueType font embedding:

More advanced example with the usage of a (subsetted) TrueType font. Basically the same example as above but with a custom font, loaded from a font file.

import PaPDF
with PaPDF("test.pdf") as pdf:
    pdf.addTrueTypeFont("<FontUserName>", "/path/to/font.ttf")
    pdf.currentFontName = "<FontUserName>"
    pdf.addText(40, 290, "Hello world")
    pdf.addText(40, 10, 'Hello world')

Adding EAN13 Barcode:

Adding a barcode is pretty straight forward. Warning: make sure the last digit checksum is correctly computed, when calling the addEAN13() function.

import PaPDF
with PaPDF("barcode.pdf") as pdf:
    pdf.addText(20, 250, "Simple EAN13 barcode example:")
    pdf.addEAN13(20, 225, "4012345123456")

Generated barcode example

Project details

Release history Release notifications

Download files

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

Files for PaPDF, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size PaPDF-1.0.3.tar.gz (15.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page