Skip to main content

A python package to create PDF files.

Project description

PaPDF

Python library to create PDF

Features:

  • Basic text writing with TrueType font embedding (including propper font subsetting)
  • Image insertion (JPEG images and PNG with transparency images support)
  • EAN13 barcode insertion

Installation:

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.

from PaPDF import PaPDF
with PaPDF("test.pdf") as pdf:
    pdf.addText(40, 290, "Hello world")
    pdf.addPage()
    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.

from PaPDF 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.addPage()
    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.

from PaPDF 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


Download files

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

Source Distribution

PaPDF-1.1.8.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

PaPDF-1.1.8-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file PaPDF-1.1.8.tar.gz.

File metadata

  • Download URL: PaPDF-1.1.8.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for PaPDF-1.1.8.tar.gz
Algorithm Hash digest
SHA256 64d1416def178f45846eb6f1da300631e7a55d22c31046d2c78736d1e8a74c76
MD5 023218fd83274872075c32b3f3db2b39
BLAKE2b-256 e3ad6aabfd377c00a87a42303227028a83c49919451221cb1579cd6c772549d4

See more details on using hashes here.

File details

Details for the file PaPDF-1.1.8-py3-none-any.whl.

File metadata

  • Download URL: PaPDF-1.1.8-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for PaPDF-1.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e4c04a8e0d8b7ef32b5d0932184225951a27f9b0346b511467089a228e18835d
MD5 443d6fea1ffebbd9ae5a78d0b9c090b5
BLAKE2b-256 e992cfd2a5cff4fb61c24f0e7685ee9ccc1ce71942dec314cf5076b5266d0619

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page