npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-zugferd-reader

v1.1.0

Published

N8N node to extract ZUGFeRD/Factur-X XML from PDF invoices

Downloads

484

Readme

N8N ZUGFeRD Reader Node

Ein N8N Custom Node zum Extrahieren von ZUGFeRD/Factur-X XML-Daten aus PDF-Rechnungen.

Features

  • ✅ Prüft ob PDF ZUGFeRD/Factur-X Daten enthält
  • ✅ Extrahiert ZUGFeRD und Factur-X XML aus PDF-Dateien
  • ✅ Automatische Erkennung der XML-Anhänge
  • ✅ Unterstützt Binary Data und Dateipfad als Input
  • ✅ Ausgabe als JSON oder Raw XML
  • ✅ Listet alle verfügbaren Anhänge auf

Installation

In N8N installieren

  1. Als Community Node:

    npm install n8n-nodes-zugferd-reader
  2. Manuell installieren:

    # Projekt bauen
    npm install
    npm run build
    
    # In N8N custom nodes Verzeichnis kopieren
    cp -r dist ~/.n8n/custom/
  3. Entwicklungsmodus:

    npm install
    npm run dev
    
    # N8N mit custom nodes starten
    n8n start

Verwendung

Operationen

Check:

  • Prüft ob die PDF ZUGFeRD/Factur-X Daten enthält
  • Gibt einen Boolean hasZugferdData zurück
  • Schnelle Validierung ohne das XML zu extrahieren/parsen
  • Nützlich für Filterung und Routing in Workflows

Extract (Standard):

  • Extrahiert und parst die ZUGFeRD/Factur-X XML-Daten
  • Gibt die vollständigen Rechnungsdaten zurück

Input Modes

Binary Data (Standard):

  • Verwendet die Binary Data aus einem vorherigen Node
  • Ideal für Workflows mit HTTP Request, Read Binary File, etc.

File Path:

  • Liest PDF direkt vom Dateisystem
  • Nützlich für lokale Dateien

Output Formats

Parsed JSON (Standard):

  • Wandelt XML in JSON um
  • Einfach zu verarbeiten in nachfolgenden Nodes

Raw XML:

  • Gibt das originale XML zurück
  • Nützlich wenn du das XML weiterverarbeiten möchtest

Both:

  • Gibt sowohl JSON als auch XML zurück

Beispiel Workflows

Workflow 1: Check und dann Extract

┌─────────────────┐    ┌──────────────────┐    ┌──────────────────┐    ┌─────────────┐
│  HTTP Request   │───▶│  ZUGFeRD Reader  │───▶│  IF Node         │───▶│  ZUGFeRD    │
│  (Get PDF)      │    │  (Check)         │    │  (hasZugferdData)│    │  Reader     │
└─────────────────┘    └──────────────────┘    └──────────────────┘    │  (Extract)  │
                                                                         └─────────────┘

Workflow 2: Direkt Extract

┌─────────────────┐    ┌──────────────────┐    ┌─────────────┐
│  HTTP Request   │───▶│  ZUGFeRD Reader  │───▶│  Process    │
│  (Get PDF)      │    │  (Extract)       │    │  Invoice    │
└─────────────────┘    └──────────────────┘    └─────────────┘

Beispiel Outputs

Check Operation:

{
  "hasZugferdData": true,
  "attachmentName": "factur-x.xml",
  "availableAttachments": ["factur-x.xml"]
}

Extract Operation:

{
  "attachmentName": "factur-x.xml",
  "availableAttachments": ["factur-x.xml"],
  "invoice": {
    "rsm:CrossIndustryInvoice": {
      "rsm:ExchangedDocumentContext": {
        "ram:GuidelineSpecifiedDocumentContextParameter": {
          "ram:ID": "urn:cen.eu:en16931:2017"
        }
      },
      "rsm:ExchangedDocument": {
        "ram:ID": "RE-2024-0001",
        "ram:TypeCode": "380",
        "ram:IssueDateTime": {
          "@_format": "102",
          "#text": "20240115"
        }
      },
      "rsm:SupplyChainTradeTransaction": {
        "ram:ApplicableHeaderTradeAgreement": {
          "ram:SellerTradeParty": {
            "ram:Name": "Muster GmbH"
          },
          "ram:BuyerTradeParty": {
            "ram:Name": "Kunde AG"
          }
        },
        "ram:ApplicableHeaderTradeSettlement": {
          "ram:InvoiceCurrencyCode": "EUR",
          "ram:SpecifiedTradeSettlementHeaderMonetarySummation": {
            "ram:TaxBasisTotalAmount": "1000.00",
            "ram:TaxTotalAmount": "190.00",
            "ram:GrandTotalAmount": "1190.00"
          }
        }
      }
    }
  }
}

Unterstützte Standards

  • ZUGFeRD 1.0 / 2.x
  • Factur-X
  • XRechnung
  • EN16931 (CII Format)

Technische Details

Dependencies

  • pdf-lib: PDF-Manipulation und Anhang-Extraktion
  • fast-xml-parser: Schnelles XML-zu-JSON Parsing

Wie es funktioniert

  1. PDF wird geladen (aus Binary Data oder Dateisystem)
  2. Eingebettete Dateien werden aus dem PDF extrahiert
  3. XML-Anhänge werden identifiziert (auto oder custom)
  4. XML wird optional zu JSON geparst
  5. Daten werden als Output zurückgegeben

Error Handling

Der Node bietet detaillierte Fehlermeldungen:

  • Keine eingebetteten Dateien gefunden
  • Kein ZUGFeRD XML gefunden (mit Liste verfügbarer Anhänge)
  • PDF-Lesefehler
  • XML-Parsing-Fehler

Entwicklung

# Dependencies installieren
npm install

# TypeScript kompilieren
npm run build

# Watch mode für Entwicklung
npm run dev

# In lokalem N8N testen
N8N_CUSTOM_EXTENSIONS=~/.n8n/custom n8n start

Lizenz

MIT

Support

Bei Problemen oder Fragen, bitte ein Issue erstellen.