Single-page viewport
Fixed one-page PDFs for certificates, cards, and receipts.
Set viewport to create a single page for a certificate, card, or receipt. With both dimensions set, percentage heights resolve against the viewport and content outside it is clipped.
import { } from "takumi-pdf";
const = await (< ={{ : "100%", : "100%" }}>Certificate</>, {
: { : 1123, : 794 }, // A4 landscape in px
});Content-sized pages
Omit height for a page that grows to fit its content, such as a thermal receipt. Use content or explicit lengths to determine element heights. Percentage heights do not resolve in this mode:
import { } from "takumi-pdf";
const = await (, { : { : 302 } }); // 80mm at 96 dpiviewport cannot be combined with size, landscape, margin, header, footer, or pageRanges. Use padding inside the document for whitespace around a single page. Hyperlinks, outline, and metadata work in both modes.
Last updated on