Fonts & images
Embed subset fonts and pre-fetched images.
Fonts
Text embeds as real glyph runs with subset fonts. It stays selectable, searchable, and copyable. Pass a URL or raw bytes. You can also use the googleFonts helper:
import { } from "@takumi-rs/helpers";
const = await (, {
: [...(await (["Inter"])), { : "Brand Sans", : 700, : }],
: ["Brand Sans", "Inter", "sans-serif"],
});fontFamilies sets the fallback chain for each render. Registered fonts deduplicate across calls that use the same renderer.
Images
The renderer never fetches over the network. Pass pre-fetched bytes for each image URL in the document:
const = new (await (await ()).());
const = await (, {
: [{ : , : }],
});SVG image sources rasterize at 2× their placed size. Raster sources embed once for each distinct pixel data.
Runtimes
takumi-pdf is wasm-only. It runs on Node.js, Bun, and Cloudflare Workers. The module fits within the Workers free-tier size limit. Import takumi-pdf/no-init to control wasm instantiation.
Last updated on