Skip to main content
Lpdf - PDF as Code

lpdfio-lpdf

Python SDK for Lpdf — PDF as Code on every platform

You describe a document as code or XML. Lpdf renders a compact, pixel-perfect PDF — identical across platforms.

Installation

pip install lpdfio-lpdf

pip install is the whole setup. The engine runs inside Python on the wasmtime package, which pip installs with the SDK: there is no program to install or put on PATH.

Usage

from lpdf import L, NoAttr, DocumentAttr, LayoutAttr, ColumnAttr, RowAttr, TextAttr, DividerAttr

engine = L.engine()

doc = L.document(DocumentAttr(size='letter'), [
    L.section(NoAttr, [
        L.layout(LayoutAttr(margin='48pt'), [
            L.column(ColumnAttr(gap='24pt'), [
                L.row(RowAttr(justify='between'), [
                    L.text(TextAttr(font_size='8pt', color='#888888'), ['ACME CORP']),
                    L.text(TextAttr(font_size='22pt', bold=True), ['Project Proposal']),
                ]),
                L.divider(DividerAttr(thickness='xs')),
                L.text(TextAttr(font_size='13pt', bold=True), ['Scope of Work']),
                L.row(RowAttr(gap='12pt', align='start'), [
                    L.text(TextAttr(color='#888888', width='24pt'), ['01']),
                    L.text(TextAttr(width='fill'), ['Discovery & Research']),
                ]),
            ]),
        ]),
    ]),
])

pdf = engine.render(doc)

A render releases the GIL, so renders on threads run in parallel: use a thread pool, or asyncio.to_thread in async code. A render stops with an EngineException after 30 seconds; L.engine(EngineOptions(timeout=60)) sets another limit in seconds, and timeout=0 sets none.

Requirements

  • Python 3.11+
  • A platform the wasmtime package has wheels for: Linux (x86_64, aarch64; glibc and musl), macOS (x86_64, arm64) or Windows (x64, arm64)

Docs

lpdf.io/docs

Issues

Report bugs and request features at github.com/lpdfio/lpdf/issues, the one tracker for the engine, the SDKs and the VS Code extension. Pull requests are not accepted.

--

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

Metadata

Release files for lpdfio-lpdf 0.31.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lpdfio-lpdf 0.31.1
File Size Uploaded Provenance Actions
lpdfio_lpdf-0.31.1.tar.gz 1.1 MB Without provenance Details for lpdfio_lpdf-0.31.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lpdfio-lpdf 0.31.1
File Interpreter ABI Platform Actions
lpdfio_lpdf-0.31.1-py3-none-any.whl Python 3 none any Details for lpdfio_lpdf-0.31.1-py3-none-any.whl

Total release size: 2.3 MB

Release files / lpdfio_lpdf-0.31.1.tar.gz

Download URL lpdfio_lpdf-0.31.1.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
b0f4d05200ebcad3caf7a9046b0eecd25a66eb9e6190a0128458787635431aa0
BLAKE2b-256 checksum
How to use checksums
42ec12755e86b4cda90b26650ea8bc546798f10ca5c834a1ef2d257ccece8e0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / lpdfio_lpdf-0.31.1-py3-none-any.whl

Download URL lpdfio_lpdf-0.31.1-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8c39eedff3fdd9c42d6a83ace52930b8560f20fade79a29f1d6c5f160b25b93a
BLAKE2b-256 checksum
How to use checksums
2d8282d31daf34f67cf7b1d5bed354402fe7fe19295cfa78880baddec882083b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for lpdfio-lpdf 0.31.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.31.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page