Skip to main content

PDF templating with Typst

Project description

Oicana

Dynamic PDF Generation based on Typst.

Oicana offers seamless PDF templating. Define your templates in Typst, specify dynamic inputs, and generate high quality PDFs from your application code.

Installation

uv add oicana

Quick Start

import json
from oicana import Template, CompilationMode

# Load your template
with open("template.zip", "rb") as f:
    template_bytes = f.read()

# Create template and compile
with Template(template_bytes) as template:
    pdf = template.export(
        json_inputs={
            "invoice": json.dumps({
                "number": "INV-001",
                "items": [{"name": "Service", "price": 100}]
            })
        },
        export={"format": "pdf"},
        mode=CompilationMode.PRODUCTION,
    )

    # Save the PDF
    with open("output.pdf", "wb") as f:
        f.write(pdf)

Features

  • Multi-platform: Works on Linux, macOS, and Windows
  • Powerful Layouting: Full access to Typst's functionality
  • Performant: Native Rust performance via PyO3
  • Type Safe: Full type hints for IDE support
  • Pythonic: Context managers, dataclasses, and enums

Documentation

For more information, visit https://oicana.com/docs

Licensing

Oicana is source-available under PolyForm Noncommercial License 1.0.0. You can use it for free in any noncommercial context. For commercial use, please visit the Oicana website for pricing options.

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

oicana-0.4.0rc1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

oicana-0.4.0rc1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file oicana-0.4.0rc1.tar.gz.

File metadata

  • Download URL: oicana-0.4.0rc1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oicana-0.4.0rc1.tar.gz
Algorithm Hash digest
SHA256 05f9e51a38ba0cf2b27e775407689ef193f976b7d80d553a4a6e45a16554f37a
MD5 b39b6114e15086b7bbedbbbbe98dde0c
BLAKE2b-256 2f6dcbe153145d60b45d4c863459756c9f5973a052b918187906aab495ebf26a

See more details on using hashes here.

Provenance

The following attestation bundles were made for oicana-0.4.0rc1.tar.gz:

Publisher: publish-integration-python.yml on oicana/oicana

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file oicana-0.4.0rc1-py3-none-any.whl.

File metadata

  • Download URL: oicana-0.4.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oicana-0.4.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 f9d76af17c6050f45a9db71b1d9753f4d9ba9677d2d94f746a9fa8724884f95f
MD5 ca778ff6361c408a9389dfb85f7692a4
BLAKE2b-256 3b9f2e4ea3edbc8bb2ed4bd6190f2ad37d3d32241f3cc950fcbbeca6b93e3fb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for oicana-0.4.0rc1-py3-none-any.whl:

Publisher: publish-integration-python.yml on oicana/oicana

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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