Skip to main content

Python adapter for Lpdf — PDF as Code, on every platform. Describe your document structure in code using the programming Kit, or XML. Every PDF is compact, pixel-perfect, and identical across platforms.

Project description

Lpdf

lpdfio-lpdf

Python adapter for Lpdf — PDF as Code, on every platform.

Describe your document structure in code using the programming Kit or XML. Every PDF is compact, pixel-perfect, and identical across platforms.

Installation

pip install lpdfio-lpdf

Usage

from lpdf import LpdfEngine

engine = LpdfEngine("")

engine.load_font("montserrat", open("fonts/Montserrat-Regular.ttf", "rb").read())
engine.load_image("logo", open("images/logo.png", "rb").read())

xml = open("document.xml", "r", encoding="utf-8").read()
pdf = engine.render_pdf(xml)

open("output.pdf", "wb").write(pdf)

XML format

Documents are defined in a layout XML format. See the Lpdf documentation and examples for the full schema.

<stack spacing="m" padding="l">
  <text font-size="xl" font="Montserrat-Bold">Invoice #1001</text>
  <grid columns="2">
    <text>Date</text>      <text>2026-04-25</text>
    <text>Due</text>       <text>2026-05-25</text>
  </grid>
</stack>

Requirements

  • Python 3.8+

License

Dual-licensed: Community License (free) and Commercial License (paid). See LICENSE for full terms.

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

lpdfio_lpdf-0.6.0.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

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

lpdfio_lpdf-0.6.0-py3-none-any.whl (48.2 kB view details)

Uploaded Python 3

File details

Details for the file lpdfio_lpdf-0.6.0.tar.gz.

File metadata

  • Download URL: lpdfio_lpdf-0.6.0.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for lpdfio_lpdf-0.6.0.tar.gz
Algorithm Hash digest
SHA256 bdbd9d953d4c09c82460feb15e4d1d2a67c223b60101018c5edb669a73c892e1
MD5 52958ada4d4cba38d3bb575d8fda3f01
BLAKE2b-256 a10d6c5d67cea8638dcebd827a2e4864a827d399dfcbf4e4693f816e04951d09

See more details on using hashes here.

File details

Details for the file lpdfio_lpdf-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: lpdfio_lpdf-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 48.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for lpdfio_lpdf-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 947b23d41db59f9a6ca08eef0ee6660773ce16d07e5667657fcf221e11a4f087
MD5 a802d02bdc8245e9c794c0bf33029bd4
BLAKE2b-256 37ef02b268127dfe6e437947ce1a51785e99a0fefb5a3e141b7a343c7964f244

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