Generate and extract Factur-X and Order-X invoices
翻譯準備中
正在載入完整 README。
檢視完整 README ↗Generate, extract, parse and validate Factur-X / ZUGFeRD and Order-X e-invoices in TypeScript, using pdf-lib and libxml2-wasm.
Conforms to Factur-X 1.09 / ZUGFeRD 2.5 (the EN 16931 European e-invoicing standard, CII D22B).
generateextractxmlToInvoiceinvoiceToXmlBR-* business rules and code lists — check (schematron: true) / validateSchematronminimum, basicwl, basic, en16931, extendedSee Profiles & flavors for the supported flavors, levels and autodetection rules.
npm install @stafyniaksacha/facturx
Requires Node.js ≥ 20.11.0. The package is ESM-only and ships its own types.
# CLI — no install required
npx @stafyniaksacha/facturx extract invoice.pdf > factur-x.xml
npx @stafyniaksacha/facturx check factur-x.xml --schematron
import { check, extract, generate } from '@stafyniaksacha/facturx'
// Embed an XML invoice into a PDF → compliant PDF/A-3 bytes
const facturxPdf = await generate({ pdf, xml })
// Pull the embedded XML back out of a Factur-X / Order-X / ZUGFeRD PDF
const { xml: extractedXml, flavor, level } = await extract({ pdf })
// Validate against the XSD (and, with schematron: true, the EN 16931 business rules)
const { valid, errors } = await check({ xml })
The flavor and level are autodetected from the XML when not provided.
Full guides and the complete API reference live on the docs site:
generate / extract / check / parsingBased on original work of akretion/factur-x python library by Alexis de Lattre