Skip to content

About

Lpdf Python SDK: render PDF documents from XML or from code. With data binding, PDF/A, PDF/UA, PDF/X and Factur-X / ZUGFeRD.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Lpdf - PDF as Code

Lpdf Python SDK: render PDF documents from XML or from code.

With data binding, PDF/A, PDF/UA, PDF/X and Factur-X / ZUGFeRD.

Installation

pip install lpdfio-lpdf

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)

Requirements

  • Python 3.11 or later, on Linux (x86_64 or aarch64, glibc or musl), macOS (x86_64 or arm64) or Windows (x64 or arm64)
  • Nothing else: the engine runs inside Python on the wasmtime package, which pip installs with the SDK

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.


Licensed under the Lpdf License. See LICENSE for full terms.

About

Lpdf Python SDK: render PDF documents from XML or from code. With data binding, PDF/A, PDF/UA, PDF/X and Factur-X / ZUGFeRD.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages