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.6.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: PaPDF-1.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 afc92a19b35d19f4d878ff803119616a9dca92107787bf71aff2ba7d4f46fdb7
MD5 316eb0645f71c5619ff9e442283f21bb
BLAKE2b-256 821361af03dd8fc734f73b70e6d1545f6d70763e737bd315d32401c919b41efb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: PaPDF-1.1.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 54610e1de29a82a37119febf430824795b5a8e509f9a57e27d39c4311e9e72d0
MD5 abf818241ba4a72d8570987c36502d7c
BLAKE2b-256 7c270a8669b415f23c392fe95d173c388612c62d3a9fcfb669e2848faf41d400

See more details on using hashes here.

Supported by

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