A Node.js library for creating ZUGFeRD/Factur-X compliant documents. Generating XML and embedding it into PDF/A files, enabling seamless e-invoicing and digital document compliance.
npm install node-zugferd
bash
npm install node-zugferd@latest
`
Default Supported Profiles
> ⚠️ Warning
> Documents containing only information of the first two profiles (MINIMUM and BASIC WL) are not considered to be invoices according to German fiscal law (→ GoBD); they may therefore not be used as electronic invoices in Germany. They will not be considered as invoices in France anymore once the einvoicing B2B mandate CTC reform has been fully deployed (2028). It is then highly recommended to target the BASIC profile at minimum.
* MINIMUM
* BASIC WL
* BASIC
* EN 16931 (COMFORT)
* EXTENDED
> 📝 Note
> By default this package only provides support for the CII-Syntax
> 💡 Tip
> You can also define your own Profiles.
If you encounter invalid or missing fields, feel free to open a new Issue or Pull Request.
Basic Usage
1. Create a new instance:
`ts
import { zugferd } from "node-zugferd";
import { BASIC } from "node-zugferd/profile/basic";
export const invoicer = zugferd({
profile: BASIC,
});
`
2. Define the documents data
`ts
import { invoicer } from "./your/path/invoicer";
const data: typeof invoicer.$Infer.Schema = {
//... your data
};
const invoice = invoicer.create(data);
`
3. Save the document
as XML
`ts
const xml = await invoice.toXML();
`
as PDF/A-3b
`ts
// The data in your pdf must exactly match the provided data!
const pdf = fs.readFileSync("./your/invoice.pdf");
const pdfA = await invoice.embedInPdf(pdf, {
metadata: {
title: "New Invoice",
},
});
``