This release is a pre-release and may not be stable for production use.
prince-pdf
Python packaging of Prince, the HTML-with-CSS to PDF engine. The wheel bundles the Prince engine for the current platform — no separate installation, no network access at install or run time.
pip install prince-pdf
import prince_pdf
prince_pdf.convert("document.html", "document.pdf")
pdf_bytes = prince_pdf.html_to_pdf("<h1>Hello</h1>") # in-memory
pdf_bytes = prince_pdf.markdown_to_pdf("# Hello") # Prince 17+
The package also puts prince on PATH, so the full
command-line interface works as
documented:
prince document.html -o document.pdf
python -m prince_pdf also works anywhere the package is importable, even
when the script directory is not on PATH.
Prince is free for non-commercial use (output carries a watermark on the
first page until a license is installed). Commercial use requires a
license from YesLogic. Point the
engine at your license file with the PRINCE_LICENSE_FILE environment
variable (preferred — it survives reinstalls), or install it at the path
returned by prince_pdf.license().
Supported platforms: Linux x86-64 and ARM64 (glibc), musl/Alpine ARM64,
macOS 10.13+ (universal), Windows x64 and ARM64. On Linux x86-64 the engine
additionally needs the system fontconfig library — in minimal containers,
apt-get install libfontconfig1 (it usually arrives with fonts anyway).
Names
One package, three names: install it as prince-pdf, import it as
prince_pdf, run it as prince. Note that pip install prince
installs an unrelated statistics library, not this package.
Python API
prince_pdf.convert(inputs, output=None, args=())— convert one or more files (HTML, XML, SVG; Markdown with Prince 17+; a list is merged into one PDF), with the format detected from each file. Extra command-line options go inargs, e.g.args=("--javascript",). Returns the output path, or the PDF asbyteswhenoutputis None.prince_pdf.html_to_pdf(html, output=None, args=()),prince_pdf.markdown_to_pdf(markdown, ...),prince_pdf.xml_to_pdf(xml, ...)— convert a document given as a string or bytes, without temporary files. Combine withoutput=Nonefor fully in-memory conversion. Markdown input requires a bundled Prince 17 or later (pip install --pre prince-pdfwhile 17 is in pre-release); on older enginesmarkdown_to_pdfraises an error saying exactly that.- Failures raise
PrinceErrorcarrying.returncode, raw.stderr, and.messages— the engine's diagnostics parsed intoMessage(severity, location, text)tuples. Engine warnings during successful conversions are emitted on the"prince_pdf"logger. prince_pdf.run(*args, **kwargs)— invoke the engine with raw command-line arguments;kwargspass through tosubprocess.run().prince_pdf.command(*args)— the argv list that would be run, for use with external process tooling.prince_pdf.executable()— path of the bundled engine binary.prince_pdf.version()— the engine's version string.prince_pdf.license()— the default license-file location inside the bundle (preferPRINCE_LICENSE_FILE, which survives reinstalls).
Troubleshooting
- Missing or wrong fonts in minimal containers: the wheel bundles the
engine but uses the system's fonts. Install some, e.g.
apt-get install fonts-dejavu fontconfig(Debian/Ubuntu) orapk add fontconfig ttf-dejavu(Alpine). libfontconfig.so.1: cannot open shared object file(Linux x86-64): install the system fontconfig library, e.g.apt-get install libfontconfig1— installing fonts as above also provides it.- Watermark on the first page: expected without a license — the engine
is fully functional for evaluation and non-commercial use. A purchased
license (via
PRINCE_LICENSE_FILE) removes it. - Documents referencing remote resources: fetching
http(s)images or stylesheets requires network access at conversion time; self-contained local files need none. - Diagnosing failures:
PrinceError.stderrcarries the engine's warnings and errors; add--verbose(or-oplus--log=FILE) for more detail.
How this repository works
This repo contains no Prince binaries and no engine source — only packaging.
versions.json— the release manifest: for each wheel platform tag, the princexml.com artifact URL and its SHA-256. Wheels are built only from artifacts that verify against this manifest, so a commit of this repo fully determines the bytes that reach PyPI.src/prince_pdf/— the wrapper module andprinceconsole script. At build time the engine's installation prefix is bundled asprince_pdf/_bundle/, and the wrapper invokes_bundle/bin/prince --prefix=<bundle>(the same thing the shipped launcher script does).build_hook.py— hatchling hook that sets the wheel's platform tag and pulls in the staged engine tree.scripts/build_wheels.py— download → verify → stage → build, for one or all platforms.scripts/update_versions.py <version>— regenerate the manifest for a new Prince release: downloads the artifacts, computes checksums, and scans the Linux binaries'GLIBC_*symbols so the manylinux tags stay honest..github/workflows/wheels.yml— builds all wheels on one Linux runner (repackaging only, no compilation), smoke-tests each wheel on its real platform (including installing and running with networking disabled), and publishes to PyPI via trusted publishing when av*tag is pushed.
Building locally
pip install build hatchling
python scripts/build_wheels.py --platform macosx_10_13_universal2
pip install dist/prince_pdf-*.whl
python tests/smoke.py
Releasing a new Prince version
python scripts/update_versions.py 17- Review the diff, commit, and push a tag matching the new package version
(
v17.0.0). - CI builds, tests, and publishes to PyPI. Packaging-only fixes between
engine releases use PEP 440 post-releases:
17.0.0.post1.
Pre-release builds map to PEP 440 versions that pip hides from ordinary
users (installed only with --pre or an exact version pin):
- Betas:
python scripts/update_versions.py 17b1→ package17.0.0b1. - Dated builds:
python scripts/update_versions.py 20260630 --dev-of 17→ package17.0.0.dev20260630. The--dev-ofmapping is required — a raw date used as a version would sort above every real release forever..devversions sort before the release they lead to (17.0.0.dev20260630 < 17.0.0b1 < 17.0.0), so once 17.0.0 ships, dated builds must target the next release:--dev-of 17.1. - The pre-release channel may build for a different Alpine range than the
stable channel; pass
--alpine-oldest 3.21accordingly.
Publish selected milestones, not nightlies: each release uploads ~200 MB of
wheels against PyPI's default 10 GB per-project quota. Old .dev releases
can be deleted from PyPI to reclaim space, and quota increases can be
requested if needed.
One-time setup on PyPI: create the prince-pdf project and add a trusted
publisher for this repository (yeslogic/prince-python, workflow
wheels.yml, environment pypi), and create the pypi environment in the
GitHub repo settings (protect it with required reviewers). No sdist is
published — there is nothing to build from source.
Metadata
Release files for prince-pdf 17.0.0.dev20260630
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| prince_pdf-17.0.0.dev20260630-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details |
| prince_pdf-17.0.0.dev20260630-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| prince_pdf-17.0.0.dev20260630-py3-none-musllinux_1_2_aarch64.whl | Python 3 | none | Linux musl 1.2+ ARM64 | Details |
| prince_pdf-17.0.0.dev20260630-py3-none-manylinux_2_25_x86_64.whl | Python 3 | none | Linux glibc 2.25+ x86-64 | Details |
| prince_pdf-17.0.0.dev20260630-py3-none-manylinux_2_25_aarch64.whl | Python 3 | none | Linux glibc 2.25+ ARM64 | Details |
| prince_pdf-17.0.0.dev20260630-py3-none-macosx_10_13_universal2.whl | Python 3 | none | macOS 10.13+ universal2 (ARM64, x86-64) | Details |
Total release size: 102.7 MB
Release files / prince_pdf-17.0.0.dev20260630-py3-none-win_arm64.whl
| Download URL | prince_pdf-17.0.0.dev20260630-py3-none-win_arm64.whl |
|---|---|
| Size | 13.6 MB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
b0ab02f0605fc47064f960d752439ceda144c519c9fec67013a3fcaf35ef0dce
|
|
BLAKE2b-256 checksum How to use checksums |
c2c8982ebf130ad580acde70da618f9e3594d24799f1265217976c9145659669
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logRelease files / prince_pdf-17.0.0.dev20260630-py3-none-win_amd64.whl
| Download URL | prince_pdf-17.0.0.dev20260630-py3-none-win_amd64.whl |
|---|---|
| Size | 15.4 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5c49f2bcfd6cdb39f65c73968fd7d1d1d5b6c31c1ba9c1a8b824d52cf432da3f
|
|
BLAKE2b-256 checksum How to use checksums |
8ea7904e92f534afcb0436e1ea5e5caf845fb905ddb0ba45f7dfc740e71d94c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logRelease files / prince_pdf-17.0.0.dev20260630-py3-none-musllinux_1_2_aarch64.whl
| Download URL | prince_pdf-17.0.0.dev20260630-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 15.5 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
0a585abc05f4c3d81bc070dbd5ac72626629b7968933bb7f3328615d3f0a0803
|
|
BLAKE2b-256 checksum How to use checksums |
49b82a3e016a57456a811870591fb2c5d39f3ba72e848d99bde5424aeb457752
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logRelease files / prince_pdf-17.0.0.dev20260630-py3-none-manylinux_2_25_x86_64.whl
| Download URL | prince_pdf-17.0.0.dev20260630-py3-none-manylinux_2_25_x86_64.whl |
|---|---|
| Size | 15.9 MB |
| Tags | Linux glibc 2.25+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
bd6116b9a93fdc99e25e40fb0b067d16f8c1684dec3c9ed235e305701676e684
|
|
BLAKE2b-256 checksum How to use checksums |
c0da1d4829e236c6433aa8c6b64a12655dcd311743d08f6174856b9c4af08acb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logRelease files / prince_pdf-17.0.0.dev20260630-py3-none-manylinux_2_25_aarch64.whl
| Download URL | prince_pdf-17.0.0.dev20260630-py3-none-manylinux_2_25_aarch64.whl |
|---|---|
| Size | 14.7 MB |
| Tags | Linux glibc 2.25+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
0ea8b40fd0c5d411e0256c5822ef98e6172e8843ba002575ada3c3589ebaffb2
|
|
BLAKE2b-256 checksum How to use checksums |
2306381e94a8e24803701630c7c8f1cbf1c831ad67f9d5d9b4cfc2fcaf631b5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logRelease files / prince_pdf-17.0.0.dev20260630-py3-none-macosx_10_13_universal2.whl
| Download URL | prince_pdf-17.0.0.dev20260630-py3-none-macosx_10_13_universal2.whl |
|---|---|
| Size | 27.4 MB |
| Tags | Python 3 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
31f45a5127f4ba4fec1806c51297ec2c2f90c57422cabbc932a30375da897358
|
|
BLAKE2b-256 checksum How to use checksums |
2c53cd1475fd36bb46b0bc18b4862023efcc2c9d5b8e5cf1b501aa5b0cbae01e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logSecurity for prince-pdf 17.0.0.dev20260630
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.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for prince_pdf-17.0.0.dev20260630-py3-none-win_arm64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.
Transparency logA 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.