renderer-puppeteer-client
A renderer-foundation plugin that prints documents to PDF through a separately deployed puppeteer-service. A document-pdf request names a stored template ({ slug, locale, variables }): the plugin resolves the template and its pdf-layout (header, signature and footer regions), embeds every image as a data URI, turns repeating table header rows into a real table head and sends the finished HTML to the service, which performs no network fetches itself. The page format, margins, file name pattern and title come from the template meta. A write handler renders with renderPdfBeforeTransaction(ctx, { slug, locale, variables }) as its beforeTransaction phase, so the print service call holds no database connection, and stores the result with storeRenderedPdf(ctx, event.prepared) in the handler: a file plus a rendered-pdf record that keeps the template and layout version, so a stored document can always be traced to the text it was created from. The puppeteer-status query tells a TenantAdmin whether the service answers; while it does not, rendering fails with a puppeteer_unavailable error (HTTP 503) and no PDF is created. image-snapshot requests still take ready HTML in payload.content, which must embed all resources as data: URIs because the service fetches no http(s) resources. Configure the endpoint and token with PUPPETEER_SERVICE_URL and PUPPETEER_AUTH_TOKEN; the client retries 502, 503 and network errors with exponential backoff (default 3 retries); 4xx, other 5xx and client timeouts fail at once, because the render has already run. The feature adds the rendered_pdfs table, so apps that mount it need a schema migration.
How it fits
Section titled “How it fits”What this feature needs to run (Requires).
flowchart TB
n_renderer_puppeteer_client["renderer-puppeteer-client"]
subgraph how_reqs["Requires"]
n_renderer_foundation["renderer-foundation"]
end
n_renderer_foundation --> n_renderer_puppeteer_client
Dependencies
Section titled “Dependencies”- Requires:
renderer-foundation - Activation: always on (not toggleable)
Extensions & cross-feature APIs
Section titled “Extensions & cross-feature APIs”- Registers extension:
renderer→puppeteer