node-zugferd
IntroductionInstallation

Installation

Getting started with node-zugferd

Quick start

npx @node-zugferd/cli@beta init

Manual Installation

Install the package

Let's start by adding node-zugferd to your project.

npm install node-zugferd@beta

Running 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:

wrangler.jsonc
{
  "compatibility_flags": ["nodejs_compat"]
}

Install a profile

You'll also need to install at least one of the available profiles:

  • Minimum
  • Basic WL
  • Basic
  • EN16931
  • Extended
  • XRechnung
  • Basic
  • Comfort

This example will use the EN 16931 profile.

npm install @node-zugferd/en-16931@beta

Create a zugferd instance

Create a zugferd instance and configure it with the installed profile.

lib/invoicer.ts
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

data.ts
import type { invoicer } from "@/lib/invoicer";

export const data: typeof invoicer.$Infer.Input.En16931 = {
  exchangedDocument: {
    invoiceNumber: "471102",
    // ...
  },
  // ...
};

Create the invoice

invoice.ts
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.

 

llms.txt
Introduction

Introduction to node-zugferd.

Minimum

Edit on GitHubPrivacyImprint

On this page

Quick startManual InstallationInstall the packageInstall a profileCreate a zugferd instanceGetting startedGenerating an invoiceDefine invoice dataCreate the invoiceSave as PDF/A-3b

How is this guide?