PeachPdf
PeachPDF is an in-process document renderer that converts HTML and CSS into PDF content without requiring a browser, external service, or desktop application.
The PeachPdf Node renders completed HTML into a PDF stream. Use it when a Workflow needs to create styled reports, invoices, statements, or digitally signed documents from HTML generated earlier in the Workflow.
Revision History
0.0.0.5 - Added document customization and certificate-based digital signing.
0.0.0.1 - Initial release.
Connection
The optional PeachPdf Connection securely stores the private certificate used to sign generated PDFs. Omit the Connection when the output does not need a digital signature.
| Property | Type | Description |
|---|---|---|
Certificate |
Certificate | X.509 certificate with the private key used to sign generated PDF documents. |
Setup Notes
Unsigned rendering does not require a Connection, authentication, or external service setup. To sign output, create a PeachPdf Connection and select its Certificate. Supply Certificate Password when the configured certificate requires one.
Embed images and fonts in the HTML with data: URIs. The Node does not fetch remote resources, and local file access is disabled.
To sign a PDF, select an X.509 certificate that includes its private key. The certificate must be within its validity period and must permit digital signatures when it contains a key-usage extension. Self-signed and privately issued certificates are accepted, but the recipient's PDF viewer determines whether the certificate is trusted.
Methods
This Node exposes one method that converts HTML and optional CSS into a PDF stream.
RenderHtmlToPdf
Renders an HTML document or fragment and returns the completed PDF. The Node applies the optional page, metadata, accessibility, and signing settings before returning the document.
| Parameter | Type | Description |
|---|---|---|
Html |
String | HTML document or fragment to render. This can be the Document output from the HTML Render Node. |
Connection |
Connection | Optional PeachPdf Connection. Supplying it enables digital signing with its private certificate. |
Stylesheet |
String | Optional CSS layered over styles already present in Html. |
Options |
Object | Optional page, fitting, metadata, language, accessibility, and signing settings. See Options Properties below. |
| Return | Type | Description |
|---|---|---|
Content |
Stream | Readable and seekable PDF content positioned at the start of the stream. |
Options Properties
| Property | Type | Description |
|---|---|---|
Options.Page Format |
Enum | Physical page format. Select A3, A4, A5, Letter, Legal, Tabloid, or Custom. The default is A4. |
Options.Landscape |
Boolean | Rotates the selected page format to landscape orientation. The default is false. |
Options.Custom Width (mm) |
Double | Required page width when Page Format is Custom. Enter a value from 10 to 2000 millimetres. |
Options.Custom Height (mm) |
Double | Required page height when Page Format is Custom. Enter a value from 10 to 2000 millimetres. |
Options.Margins |
Object | Optional per-edge page margins. Omitted edges retain the PeachPDF defaults. |
Options.Fit Mode |
Enum | Select None, ShrinkToFit, or ScaleToFit to control how content fits the selected page width. The default is None. |
Options.Metadata |
Object | Optional PDF metadata overrides. Omitted values remain sourced from the HTML where available. |
Options.Default Language |
String | Fallback document language when the HTML element does not contain a lang attribute. |
Options.Enable Tagged PDF |
Boolean | Creates a tagged PDF structure from semantic HTML for accessibility. The default is false. |
Options.Signing |
Object | Optional per-document audit information used with the Connection. Supplying these settings without a Connection causes the method to fail. |
Margin Properties
Each margin accepts a value from 0 to 200 millimetres.
| Property | Type | Description |
|---|---|---|
Options.Margins.Top (mm) |
Double | Optional top page margin. |
Options.Margins.Right (mm) |
Double | Optional right page margin. |
Options.Margins.Bottom (mm) |
Double | Optional bottom page margin. |
Options.Margins.Left (mm) |
Double | Optional left page margin. |
Metadata Properties
| Property | Type | Description |
|---|---|---|
Options.Metadata.Title |
String | PDF title that overrides the title sourced from the HTML. |
Options.Metadata.Author |
String | PDF author that overrides author metadata sourced from the HTML. |
Options.Metadata.Subject |
String | PDF subject that overrides subject metadata sourced from the HTML. |
Options.Metadata.Keywords |
String | PDF keywords that override keyword metadata sourced from the HTML. |
Options.Metadata.Creator |
String | Application or process recorded as the PDF creator. |
Signing Properties
| Property | Type | Description |
|---|---|---|
Options.Signing.Reason |
String | Optional reason recorded in the PDF signature. |
Options.Signing.Location |
String | Optional signing location recorded in the PDF signature. |
Options.Signing.Contact Information |
String | Optional signer contact information recorded in the PDF signature. |
Usage Notes
Using HTML Render Output
Use the HTML Render Node before PeachPdf when content must be inserted into an HTML template. Map HTML Render's Document output to PeachPdf's Html parameter.
HTML Render resolves placeholders such as {{Name}} and {{AnnualRevenue format="#,#0.00"}}. PeachPdf receives the completed HTML and renders it without performing additional placeholder replacement.
CSS inside the HTML document remains part of the input. You can therefore define the document's visible signature block, fonts, colours, tables, and paged-media rules in the HTML Render template. Use Stylesheet when the Workflow needs to supply additional CSS separately.
Page Layout
The default output is A4 portrait. Use Options when the Workflow must enforce a different page format, landscape orientation, margins, fitting behavior, metadata, language, or tagged-PDF output.
CSS paged-media rules such as page-break-before, page-break-after, margin boxes, and running headers or footers can be included in the HTML or Stylesheet.
Digital Signing
Supplying the Connection adds an invisible detached PKCS#7 signature using SHA-256. The Connection's certificate is embedded in the signature, and the application name is always Flowgear PeachPdf. Certificate Password is stored as a masked value and is not written to the PDF.
Any visible name, handwritten-signature image, approval panel, or signing date must be rendered in the source HTML. The digital signature then protects that visible content together with the rest of the completed PDF.
A valid signature proves that the signed bytes have not changed and that the signer possessed the certificate's private key. Certificate trust and signer identity still depend on the recipient's PDF viewer and trust configuration.
The Node does not encrypt the PDF, add document passwords, or apply PDF permission controls.
Known Issues
- PeachPDF does not support every browser HTML or CSS feature. Complex layouts can differ from their appearance in a web browser.
- Remote resources are not downloaded and local files cannot be read. Embed required assets with
data:URIs. - PeachPDF does not expose cancellation during its internal render pass. Cancellation is observed before and after rendering and during signing.
- Digital signatures do not include a trusted timestamp, online revocation evidence, or PAdES long-term validation.