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

pip install 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.compile(
        json_inputs={
            "invoice": json.dumps({
                "number": "INV-001",
                "items": [{"name": "Service", "price": 100}]
            })
        },
        export_format={"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://docs.oicana.com

License

This project is licensed under the PolyForm Noncommercial License 1.0.0. See the LICENSE.md file for details.

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.1.0a1.tar.gz (153.2 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.1.0a1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file oicana-0.1.0a1.tar.gz.

File metadata

  • Download URL: oicana-0.1.0a1.tar.gz
  • Upload date:
  • Size: 153.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for oicana-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 1739bf78040602708617c36e565e6cf9b5b3023b1ecb2cbd2c661710f11d3c46
MD5 9081b02fbf3f682643c6d854fd56db1f
BLAKE2b-256 8d7a4fd00cf7d283a45496307956200a245ddfd1b867cd66d9a9c6497eda6e1f

See more details on using hashes here.

File details

Details for the file oicana-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: oicana-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for oicana-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb5d930e4ba35f3bf0c65c26cf471e9790dbbeb6278a031a3a085e004624a634
MD5 9a4fa27ca06dc1f131e7976a2f65d133
BLAKE2b-256 9aaa42905bae2d2a6e74a9329a6092cdaa9becc735423546fd6b7c51d10fbce7

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