Skip to content

API Reference parrot.flows.thales.rendering.document

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.flows.thales.rendering.document

View source

Final-document composition + optional PDF rasterization (FEAT-425 Module 4).

Pure, deterministic print-CSS composition. Optional real-.pdf emission via a lazily-imported weasyprint (mirrors the _import_weasyprint pattern at a2ui_renderers/pdf.py:36) — the pdf extra stays optional and its absence is never fatal (spec AC).

Alias Bibliography

Re-exported from parrot.flows.thales.models.Bibliography.

Alias TemplateEngine

Re-exported from parrot.template.engine.TemplateEngine.

Attribute logger

Function rasterize_pdf

Rasterize a final-document HTML string to PDF bytes via weasyprint.

Weasyprint executes no JavaScript, so charts in html must already be the static-SVG variant for this to render correctly (handled by :mod:~parrot.flows.thales.rendering.slides, which always emits both paths).

rasterize_pdf(html: str) -> bytes | None

Parameter Type Default Description
html str The document HTML (see :func:render_document).

Returns: bytes | None — PDF bytes, or None (with a warning logged) when weasyprint is not importable.

Function render_document

Compose the final print-CSS HTML document.

render_document(slides_html: list[str], bibliography: Bibliography, *, title: str) -> str

Parameter Type Default Description
slides_html list[str] Already-rendered slide HTML fragments (see :func:~parrot.flows.thales.rendering.slides.render_slide), in display order.
bibliography Bibliography The deduplicated, APA-ish formatted bibliography — always rendered as the document's final section.
title str The document title.

Returns: str — Deterministic HTML: @page rules, a page-break after every slide, and the bibliography as the last section.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally