HTML → PDF · Serverless

PDF Generator

A simple API for turning HTML into professional PDF documents — invoices, contracts, receipts and reports. Print-safe margins, custom page sizes, and ISDOC attachments in one endpoint.

Endpoint

One URL, everything else is a query parameter

POST https://pdf.bizkithub.com/generator

Send the HTML as request body (text/html or plain text). Query parameters control layout, margins, paper size and receipt mode. Use multipart/form-data when embedding files — see attachments.

Parameters

Query parameters

Every parameter has a safe default. Provide only what you need.

ParameterTypeBehavior
contentstringHTML content to render. Usually sent as POST body. For GET requests it can be provided as ?content=.
formatstringStandard paper format (e.g. A4, Letter, …). Used when width is not set. Default is A4.
widthstringCustom page width (CSS length, e.g. 80mm, 210mm, 800px). When set, it overrides format and makes the page size explicit.
heightstringCustom page height (CSS length). Used only in fixed-size mode. If width is set and fitHeight is not enabled, the default height behaves like A4 height (297mm).
autoHeightbooleanSwitches from zero margins to print-safe margins that apply consistently across pages. Improves page breaks and prevents content from being cut off.
marginstringOverrides margin size when autoHeight=true. Accepts CSS shorthand (1–4 values), e.g. 12mm 10mm or 2mm.
fitHeightbooleanReceipt mode: generates a single-page PDF whose height is derived from rendered content. Ideal for receipts and long single documents where pagination is not desired. Works best together with width (e.g. 80mm).
uuidstringOptional identifier. Stored in PDF metadata keywords.
authorstringOptional author label included in PDF metadata (Author/Creator/Producer).

Defaults: without autoHeight margins are zero. With autoHeight=true the service applies sensible print margins (A4-style for standard pages, smaller margins for narrow receipt widths). Use margin to override.

How it combines

Three rules that determine every output

1

Paper sizing priority

If width is provided, it becomes the primary sizing input and overrides format. If height is also provided, the page size is fully explicit. If only width is provided (and fitHeight is not enabled), a standard page height is used as default.

2

Margins are controlled by autoHeight

By default, the service renders with zero margins. When autoHeight=true is enabled, margins are applied consistently across pages, improving print correctness and page breaks. Use margin to override the default size.

3

Receipt mode (fitHeight)

When fitHeight=true is enabled, the PDF is generated as a single page whose height is derived from the rendered content. Avoids pagination and is best used with a fixed width (e.g. 80mm) and small margins.

Examples

Common configurations

Copy, tweak, ship.

Default — zero margins

Renders content edge-to-edge. Best for full-bleed designs or when you fully control your own internal padding in HTML.

POST https://pdf.bizkithub.com/generator

A4 with print-safe margins

Recommended for multi-page documents. Enables consistent per-page margins so page breaks don’t clip content.

POST https://pdf.bizkithub.com/generator?autoHeight=true

Narrow page with print-safe pagination

Useful for narrow documents that can still paginate (very long receipts or logs).

POST https://pdf.bizkithub.com/generator?autoHeight=true&width=80mm

Receipt mode — single-page auto height

Ideal for thermal receipts: no pagination, height is computed from rendered content.

POST https://pdf.bizkithub.com/generator?autoHeight=true&fitHeight=true&width=80mm&margin=2mm

Custom margin size

Override margins when autoHeight is enabled. Accepts CSS shorthand (1–4 values).

POST https://pdf.bizkithub.com/generator?autoHeight=true&width=80mm&margin=2mm

Explicit page size (labels, tickets)

For fully controlled page sizing.

POST https://pdf.bizkithub.com/generator?autoHeight=true&width=100mm&height=150mm&margin=4mm

Tip: in multi-page mode, keep your HTML layout “print friendly” (avoid fixed-height containers for long content). For receipts in fitHeight mode, keep content width responsive and let text wrap naturally.

File attachments

Embed ISDOC, XML, JSON… inside the PDF

One hybrid file: human-readable PDF plus machine-readable data. Adobe Reader shows attachments; Czech accounting systems (Pohoda, Money, iDoklad) auto-extract ISDOC.

How to send

Switch the request Content-Type from text/html to multipart/form-data. All existing query parameters (format, width, autoHeight, uuid, …) keep working. When attachments aren't needed, keep sending text/html — that path is fully backwards-compatible.

Multipart partRepeatablePurpose
htmlnoThe HTML to render — same content the plain text/html body would carry.
attachmentyes (0…N)Each file part is embedded into the resulting PDF. Filename comes from the part's filename= Content-Disposition; MIME type from the part's Content-Type.
attachments_metanoOptional JSON array of { filename, relationship?, description?, mimeType? } objects. Matches entries by filename. Fields override auto-detection.

Manifest fields

  • relationshipSource / Data / Alternative / Supplement / Unspecified (PDF/A-3 AFRelationship). Default: Unspecified, or Source when the filename ends in .isdoc.
  • description — human-readable label shown in the reader's attachments panel.
  • mimeType — override the auto-detected MIME. For .isdoc / .xml the default is application/xml.

Hybrid invoice: PDF with ISDOC embedded (auto-detected)

The .isdoc extension automatically gets relationship=Source and mimeType=application/xml.

curl -X POST 'https://pdf.bizkithub.com/generator?autoHeight=true&uuid=inv-2026-001' \
  -F 'html=@invoice.html;type=text/html' \
  -F 'attachment=@invoice-2026-001.isdoc' \
  -o invoice.pdf

Same invoice with explicit metadata

Use attachments_meta to set a human description or override the relationship.

curl -X POST 'https://pdf.bizkithub.com/generator?autoHeight=true' \
  -F 'html=@invoice.html;type=text/html' \
  -F 'attachment=@invoice-2026-001.isdoc;type=application/xml' \
  -F 'attachments_meta=[{"filename":"invoice-2026-001.isdoc","relationship":"Source","description":"ISDOC 6.0.2 e-invoice"}]' \
  -o invoice.pdf

Multiple attachments (ISDOC + a supplement)

Repeat the -F attachment=@… flag; add manifest entries for each.

curl -X POST 'https://pdf.bizkithub.com/generator?autoHeight=true' \
  -F 'html=@invoice.html;type=text/html' \
  -F 'attachment=@invoice-2026-001.isdoc' \
  -F 'attachment=@delivery-note.pdf' \
  -F 'attachments_meta=[{"filename":"delivery-note.pdf","relationship":"Supplement","description":"Delivery note"}]' \
  -o invoice.pdf

Limits. Each attachment is capped at 25 MB. Bigger payloads should be linked from the invoice instead of embedded.

PDF/A-3. The output is a standard PDF with embedded files — not certified PDF/A-3. In practice Czech accounting software accepts ISDOC in any PDF; if you need strict PDF/A-3 conformance for a government portal, post-process with Ghostscript or veraPDF.

Open the full documentation