Skip to content

Latest commit

 

History

History
115 lines (82 loc) · 3.22 KB

File metadata and controls

115 lines (82 loc) · 3.22 KB

node-zugferd

project-image

Caution

[WIP] This package is still under development.

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.

Table of Contents

Features

  • Create Factur-X compliant xml
  • Attach xml to pdf/a-3b
  • Validate xml

Installation

Install node-zugferd with npm:

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:

    import { zugferd } from "node-zugferd";
    import { BASIC } from "node-zugferd/profile/basic";
    
    export const invoicer = zugferd({
        profile: BASIC,
    });
  2. Define the documents data

    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
    const xml = await invoice.toXML();
    as PDF/A-3b
    // 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",
        },
    });

Dependencies

License

Distributed under the MIT License. See LICENSE.md for more information.