Fullbleed
Deterministic, dependency-free HTML/CSS-to-PDF generation in Rust, with a Python-first CLI and Python engine bindings.
Positioning
Fullbleed is not a web-to-print runtime, and does not aim to be one.
Fullbleed is a document creation engine: HTML and CSS are used as a familiar DSL for layout, styling, and data placement in transactional documents.
HTML/CSS are the familiar document DSL; with pinned assets and flags, Fullbleed targets reproducible outputs.
This README is the canonical usage guide for:
fullbleedCLI (human workflows + machine/agent automation)fullbleedPython bindings (PdfEngine,AssetBundle, batch APIs)
What You Get
- No headless browser requirement for PDF generation.
- Deterministic render pipeline with optional SHA256 output hashing.
- Reproducibility workflow via
--repro-recordand--repro-check. - PDF
1.7as the production-stable default target. - Structured JSON result schemas for CI and AI agents.
- Offline-first asset model with explicit remote opt-in.
- Python-first extension surface for hackability and custom workflows.
- Python render calls release the GIL while Rust rendering executes.
- Rayon-backed parallelism for batch rendering and selected internal engine workloads.
Concurrency Model
- Python binding render methods release the GIL during Rust execution (
py.allow_threads(...)in the bridge). - Parallel batch APIs are explicitly Rayon-backed (
render_pdf_batch_parallel(...)and parallel-to-file variants). - The engine also uses Rayon in selected internal hotspots (for example table layout and JIT paint paths).
- Do not assume every single-document render path will fully saturate all cores end-to-end.
Install
From a local wheel:
Platform artifact policy:
- Linux (
manylinux) and Windows wheels are built as release artifacts. - Linux wheel builds are smoke-tested in Ubuntu/WSL during release prep.
- macOS wheel artifacts are built in CI, but are currently maintainer-untested.
- If macOS wheel behavior differs from your environment, open an issue and include
fullbleed doctor --json.
Verify command surface:
## 60-Second Quick Start (Project Happy Path)
Initialize project scaffold:
```bash
fullbleed init .
fullbleed init now vendors Bootstrap (5.0.0) into vendor/css/bootstrap.min.css,
vendors Bootstrap Icons (1.11.3) into vendor/icons/bootstrap-icons.svg,
vendors inter into vendor/fonts/Inter-Variable.ttf, writes license notices
(vendor/css/LICENSE.bootstrap.txt, vendor/icons/LICENSE.bootstrap-icons.txt, vendor/fonts/LICENSE.inter.txt),
and seeds assets.lock.json with pinned hashes.
Install additional project assets (defaults to ./vendor/... in project context):
Bootstrap baseline note:
- We target Bootstrap (
5.0.0) as the default styling baseline for project workflows. - Re-run
fullbleed assets install bootstrap --jsononly if you want to explicitly refresh/bootstrap-manage outsideinit.
Render from files:
One-off Quick Render (No Project Scaffold)
Render inline HTML/CSS with reproducibility artifacts:
Re-run and enforce reproducibility against a stored record:
Generate PNG page artifacts from an existing validation render:
Compile-only plan (no render):
CLI Command Map
| Command | Purpose | JSON Schema |
|---|---|---|
render |
Render HTML/CSS to PDF with optional PNG page artifacts | fullbleed.render_result.v1 |
verify |
Validation render path with optional PDF and PNG emits | fullbleed.verify_result.v1 |
plan |
Compile/normalize inputs into manifest + warnings | fullbleed.plan_result.v1 |
run |
Render using Python module/file engine factory | fullbleed.run_result.v1 |
compliance |
License/compliance report for legal/procurement | fullbleed.compliance.v1 |
debug-perf |
Summarize perf JSONL logs | fullbleed.debug_perf.v1 |
debug-jit |
Filter/inspect JIT JSONL logs | fullbleed.debug_jit.v1 |
doctor |
Runtime capability and health checks | fullbleed.doctor.v1 |
capabilities |
Machine-readable command/engine capabilities | fullbleed.capabilities.v1 |
assets list |
Installed and optional remote packages | fullbleed.assets_list.v1 |
assets info |
Package details + hashes/sizes | fullbleed.assets_info.v1 |
assets install |
Install builtin/remote package | fullbleed.assets_install.v1 |
assets verify |
Validate package and optional lock constraints | fullbleed.assets_verify.v1 |
assets lock |
Write/update assets.lock.json |
fullbleed.assets_lock.v1 |
cache dir |
Cache location | fullbleed.cache_dir.v1 |
cache prune |
Remove old cached packages | fullbleed.cache_prune.v1 |
init |
Initialize project scaffold | fullbleed.init.v1 |
new |
Create starter template files | fullbleed.new_template.v1 |
Schema discovery for any command/subcommand:
CLI Flags That Matter Most
Global machine flags:
--json: structured result payload to stdout--json-only: implies--jsonand--no-prompts--schema: emit schema definition and exit--no-prompts: disable interactive prompts--config: load defaults from a config file--log-level error|warn|info|debug: control CLI log verbosity--no-color: disable ANSI color output--version: print CLI version and exit
Render/verify/plan key flags:
- Inputs:
--html,--html-str,--css,--css-str--htmlaccepts.svgfiles for direct SVG-document rendering;--html-straccepts inline SVG markup. - Page setup:
--page-size,--page-width,--page-height,--margin,--page-margins - Engine toggles:
--reuse-xobjects,--svg-form-xobjects,--svg-raster-fallback,--shape-text,--unicode-support,--unicode-metrics - PDF/compliance:
--pdf-version,--pdf-profile,--color-space,--document-lang,--document-titleStable default is--pdf-version 1.7for shipping workflows. Output intent metadata (--output-intent-identifier|--output-intent-info|--output-intent-components) requires--output-intent-icc. - Watermarking:
--watermark-text,--watermark-html,--watermark-image,--watermark-layer,--watermark-semantics,--watermark-opacity,--watermark-rotation - Artifacts:
--emit-jit,--emit-perf,--emit-glyph-report,--emit-page-data,--emit-image,--image-dpi,--deterministic-hash - Assets:
--asset,--asset-kind,--asset-name,--asset-trusted,--allow-remote-assets - Profiles:
--profile dev|preflight|prod - Fail policy:
--fail-on overflow|missing-glyphs|font-subst|budget - Fallback policy:
--allow-fallbacks(keeps fallback diagnostics, but does not failmissing-glyphs/font-substgates) - Reproducibility:
--repro-record <path>,--repro-check <path> - Budget thresholds:
--budget-max-pages,--budget-max-bytes,--budget-max-ms - Release gates:
doctor --strict,compliance --strict --max-audit-age-days <n> - Commercial attestation (compliance):
--license-mode commercial,--commercial-licensed,--commercial-license-id,--commercial-license-file
SVG Workflows
Fullbleed supports SVG in three practical CLI paths:
- Direct SVG document render via
--html <file.svg> - Inline SVG markup via
--html-str "<svg ...>...</svg>" - Referenced SVG assets via
--asset <file.svg>(kind auto-infers tosvg)
Standalone SVG file to PDF:
Inline SVG markup to PDF:
HTML template with explicit SVG asset registration:
SVG render behavior flags:
--svg-form-xobjects/--no-svg-form-xobjects--svg-raster-fallback/--no-svg-raster-fallback
Machine discovery:
Inspect the svg object in fullbleed.capabilities.v1 for SVG support metadata.
Per-Page Templates (page_1, page_2, page_n)
Fullbleed uses ordered page templates internally. In docs, this is easiest to think of as:
page_1: first page templatepage_2: second page templatepage_n: repeating template for later pages
Configuration mapping:
- CLI
--page-marginskeys:1,2, ... and optional"n"(or"each"alias). - Python
PdfEngine(page_margins=...): same key model. - Missing numeric pages fall back to the base
margin. - The last configured template repeats for remaining pages.
Minimal CLI example:
Minimal Python example:
=
Note:
- CLI currently exposes
--header-each/--footer-each(and--header-html-each/--footer-html-each). - For
first/lastheader/footer variants (header_first,header_last,footer_first,footer_last), use the Python API.
Asset Workflow (CLI)
List installed + available packages:
Install builtin assets:
# `@bootstrap` / `@bootstrap-icons` / `@noto-sans` are also supported aliases
PowerShell note:
- Quote
@aliases (for example"@bootstrap") to avoid shell parsing surprises.
Install remote asset package:
Install to a custom vendor directory:
Install to global cache:
Install common barcode fonts (license-safe defaults):
Verify against lock file with strict failure:
Preview cache cleanup without deleting files:
Notes:
- Builtin packages accept both plain and
@references (bootstrap==@bootstrap,bootstrap-icons==@bootstrap-icons,noto-sans==@noto-sans). - Project installs default to
./vendor/when project markers are present (assets.lock.json,report.py, orfullbleed.tomlin CWD). - If no project markers are found,
assets installdefaults to global cache unless--vendoris explicitly set. - Do not hardcode cache paths like
%LOCALAPPDATA%/fullbleed/cache/...; useassets install --jsonand consumeinstalled_to. - Installed assets include license files in typed vendor directories (for example
vendor/fonts/,vendor/css/). assets lock --addis currently aimed at builtin package additions.- Barcode packages in the remote registry are currently OFL-1.1 families from Google Fonts (
Libre Barcode). - USPS IMB fonts are not currently auto-installable via
assets install; use local vetted font files and track licensing separately.
Bootstrap Vendoring + Coverage
Bootstrap builtin package details:
- Package:
bootstrap(alias:@bootstrap) - Bundled version:
5.0.0 - Asset kind: CSS (
bootstrap.min.css) - Default install location:
vendor/css/bootstrap.min.css(project mode) - License:
MIT - License source:
https://raw.githubusercontent.com/twbs/bootstrap/v5.0.0/LICENSE
Bootstrap Icons builtin package details:
- Package:
bootstrap-icons(alias:@bootstrap-icons) - Bundled version:
1.11.3 - Asset kind: SVG sprite (
bootstrap-icons.svg) - Default install location:
vendor/icons/bootstrap-icons.svg(project mode) - License:
MIT - License source:
https://raw.githubusercontent.com/twbs/icons/v1.11.3/LICENSE
Transactional-document coverage status:
[sat]Bootstrap is vendored and installable through the asset pipeline.[sat]Current Bootstrap preflight pass set is suitable for static transactional PDF workflows.[sat]Bootstrap CSS is consumed as an explicit asset (--asset @bootstraporAssetBundle); external HTML<link rel="stylesheet">is not the execution path.- Evidence source:
bootstrap_preflight.md(visual pass dated2026-02-10).
Current [pass] fixtures from Bootstrap preflight:
| Feature | Status | Evidence |
|---|---|---|
components/pagination |
[pass] | examples/bootstrap5/out/components_pagination_component_page1.png |
content/inline_styles |
[pass] | examples/bootstrap5/out/content_inline_styles_component_page1.png |
content/tables |
[pass] | examples/bootstrap5/out/content_tables_component_page1.png |
content/typography |
[pass] | examples/bootstrap5/out/content_typography_component_page1.png |
helpers/text_truncation |
[pass] | examples/bootstrap5/out/helpers_text_truncation_component_page1.png |
layout/bank_statement |
[pass] | examples/bootstrap5/out/layout_bank_statement_component_page1.png |
layout/breakpoints |
[pass] | examples/bootstrap5/out/layout_breakpoints_component_page1.png |
layout/columns |
[pass] | examples/bootstrap5/out/layout_columns_component_page1.png |
layout/containers |
[pass] | examples/bootstrap5/out/layout_containers_component_page1.png |
layout/grid |
[pass] | examples/bootstrap5/out/layout_grid_component_page1.png |
layout/gutters |
[pass] | examples/bootstrap5/out/layout_gutters_component_page1.png |
layout/layout_and_utility |
[pass] | examples/bootstrap5/out/layout_layout_and_utility_component_page1.png |
utilities/text_decoration |
[pass] | examples/bootstrap5/out/utilities_text_decoration_component_page1.png |
utilities/utilities |
[pass] | examples/bootstrap5/out/utilities_utilities_component_page1.png |
utilities/z_index |
[pass] | examples/bootstrap5/out/utilities_z_index_component_page1.png |
run Command (Python Factory Interop)
run lets the CLI use a Python-created engine instance.
report.py:
return
CLI invocation:
Entrypoint formats:
module_name:factory_or_enginepath/to/file.py:factory_or_engine
Python API Quick Start
=
=
=
=
Register local assets with AssetBundle:
=
=
Python API Signatures (Runtime-Verified)
These signatures are verified from the installed package via inspect.signature(...).
PdfEngine constructor:
Module exports:
PdfEngineAssetBundleAssetAssetKindWatermarkSpec(kind, value, layer='overlay', semantics=None, opacity=0.15, rotation_deg=0.0, font_name=None, font_size=None, color=None)concat_css(parts)vendored_asset(source, kind, name=None, trusted=False, remote=False)fetch_asset(url)
PdfEngine methods:
| Method | Return shape |
|---|---|
register_bundle(bundle) |
None |
render_pdf(html, css) |
bytes |
render_pdf_to_file(html, css, path) |
int (bytes written) |
render_pdf_with_glyph_report(html, css) |
(bytes, list) |
render_pdf_with_page_data(html, css) |
(bytes, page_data_or_none) |
render_pdf_batch(html_list, css) |
bytes |
render_pdf_batch_parallel(html_list, css) |
bytes |
render_pdf_batch_to_file(html_list, css, path) |
int |
render_pdf_batch_to_file_parallel(html_list, css, path) |
int |
render_pdf_batch_to_file_parallel_with_page_data(html_list, css, path) |
(bytes_written, page_data_list) |
render_pdf_batch_with_css(jobs) |
bytes |
render_pdf_batch_with_css_to_file(jobs, path) |
int |
AssetBundle methods:
add_file(path, kind, name=None, trusted=False, remote=False)add(asset)assets_info()css()
Python Examples (Smoke-Checked)
Text watermark + diagnostics:
=
=
=
=
Batch render + glyph/page-data checks:
=
=
=
, =
, =
Transactional Header/Footer + Totals
Minimal, self-contained Python example (no external template files) showing:
- Continued headers on page 2+.
- Per-page subtotal footer expansion via
{sum:items.amount}. - Final-page grand total footer expansion via
{total:items.amount}. - Structured
page_datatotals for automation and reconciliation checks.
=
# enough rows to force multiple pages
= 10.00 + + 0.25
= f
=
=
, =
assert >= 2
assert ==
API note:
- For transactional running totals (
paginated_context) and HTML header/footer placement (header_html_*,footer_html_*), use the PythonPdfEngineAPI path. - The CLI currently exposes direct text header/footer flags (
--header-each,--footer-each) for simpler cases.
CLI watermark parity example:
Reference-Image Parity Workflow (Practical)
When targeting a design reference image (for example reference image exports), this loop has worked well:
- Start from
fullbleed initso CSS/font/icon baselines are vendored and pinned. - Register assets through the CLI (
--asset ...) orAssetBundle; do not rely on HTML<link rel="stylesheet">. - Iterate with image artifacts enabled:
- Use
--repro-record/--repro-checkonce your layout stabilizes.
Known caveats:
- Source reference images are often cropped viewports, not full page canvases.
--fail-on overflowcan still be over-sensitive on some full-page wrapper layouts (use with intent and verify with JIT artifacts).
Public Golden Regression Suite
Launch-grade render regression coverage is available under goldens/ with three fixtures:
invoicestatementmenu
Golden contract assets:
- Expected hashes:
goldens/expected/golden_suite.expected.json - Expected PNG baselines:
goldens/expected/png/<case>/<case>_page1.png
Run against committed expectations:
Refresh baselines intentionally:
Human + AI Operating Mode
Recommended automation defaults:
Why this is agent-safe:
- For command-execution JSON payloads,
schemais always present. - Parser usage errors (
exit=2) are emitted by argparse as usage text, not JSON payloads. okindicates success/failure without parsing text.- Optional artifacts are explicitly named in
outputs. - Schema introspection is available at runtime (
--schema).
Example parse loop:
=
=
assert ==
assert is True
MACHINE_CONTRACT.v1
Important Behavior Notes
render --jsoncannot be combined with--out -(stdout PDF bytes).verifydefaults to stdout PDF unless--emit-pdfis provided; for machine mode, use--emit-pdf <path>.--emit-image <dir>writes per-page PNGs as<stem>_pageN.png(stem comes from--out/--emit-pdf, orrenderwhen streaming PDF to stdout).- If both
--emit-page-dataand--emit-glyph-reportare set, render is performed twice. - Production target is PDF
1.7. runaccepts--html-strwithout requiring--html.runemits a one-time AGPL/commercial licensing reminder; suppress with--no-license-warnor by activating commercial attestation (FULLBLEED_LICENSE_MODE=commercial+FULLBLEED_COMMERCIAL_LICENSED=1).initnow scaffoldsCOMPLIANCE.mdfor project-level release review.compliance --jsonemits machine-readable legal/procurement diagnostics.--watermark-layer underlayis accepted as a legacy alias and normalized tobackground.--emit-manifestincludes awatermarkobject withtext|html|image|layer|semantics|opacity|rotation|enabled.--fail-on overflowis enforced from placement data and may auto-enable internal JIT planning.--fail-on font-substis enforced using missing glyph and fallback diagnostics.--allow-fallbacksallows fallback diagnostics to remain informational formissing-glyphs/font-substgates while still reporting them in JSON output.--fail-on budgetrequires at least one budget threshold flag.--repro-checkfails on input/hash drift and lock hash mismatches when lock data is available.--pdf-profile pdfx4enforces embedded-font constraints; CLI errors include an actionable hint to add an embeddable font asset.argparseusage errors exit with code2and emit usage text (not JSON), even when--jsonis present.
Related Docs
- Agent workflow guide:
AI.md - CLI JSON contract quick reference:
cli_schema.md - CLI epoch/spec:
CLI_EPOCH.md - Licensing guide:
LICENSING.md - Third-party notices:
THIRD_PARTY_LICENSES.md - Living docs example project:
examples/living_docs_atlas/README.md - Roofing invoice parity example:
examples/roofing_invoice/README.md - Iconography smoke example:
examples/iconography_test/README.md - Public golden regression suite:
goldens/README.md
License
Fullbleed is dual-licensed:
- Open-source option:
AGPL-3.0-only(LICENSE) - Commercial option:
LicenseRef-Fullbleed-Commercial(LICENSING.md)
SPDX expression:
-
AGPL-3.0-only OR LicenseRef-Fullbleed-Commercial -
Copyright notice:
COPYRIGHT -
Third-party notices:
THIRD_PARTY_LICENSES.md -
Practical licensing guide:
LICENSING.md
For license information, please visit fullbleed.dev or email info@fullbleed.dev.
License integrity gate (CI-friendly, no build required):
Commercial compliance attestation examples:
# env-based attestation (useful in CI/containers)
# Process-local helper for library users and agent runtimes.