Installation
Getting started with node-zugferd
Quick start
npx @node-zugferd/cli@beta initManual Installation
Install the package
Let's start by adding node-zugferd to your project.
npm install node-zugferd@betaRunning on Cloudflare Workers
node-zugferd uses Node.js APIs such as AsyncLocalStorage.
Cloudflare Workers enable Node.js compatibility
by default from compatibility date 2026-08-04.
For an earlier date, add the nodejs_compat flag to your Wrangler configuration:
{
"compatibility_flags": ["nodejs_compat"]
}Install a profile
You'll also need to install at least one of the available profiles:
This example will use the EN 16931 profile.
npm install @node-zugferd/en-16931@betaCreate a zugferd instance
Create a zugferd instance and configure it with the installed profile.
import { zugferd } from "node-zugferd";
import { en16931 } from "@node-zugferd/en-16931";
export const invoicer = zugferd({
profiles: [en16931],
});Getting started
Generating an invoice
Define invoice data
import type { invoicer } from "@/lib/invoicer";
export const data: typeof invoicer.$Infer.Input.En16931 = {
exchangedDocument: {
invoiceNumber: "471102",
// ...
},
// ...
};Create the invoice
import { invoicer } from "@/lib/invoicer";
import { data } from "./data";
export const invoice = invoicer.create("en-16931", data);Save as PDF/A-3b
import { readFile } from "node:fs/promises";
import { invoice } from "./invoice";
const pdfA = await invoice.toPDF(
await readFile("invoice.pdf"),
);
const bytes = await pdfA.save();
// further process the document, e.g upload to object storage, send via email, etc.