Skip to content

PDF A3 EInvoice

SIDHARTH SINGH edited this page Dec 3, 2026 · 1 revision

PDF/A-3b & Hybrid E-Invoice Pipelines (renderEInvoice)

Electronic invoicing across both Europe (ZUGFeRD / Factur-X EN 16931) and India (GST IRP IRN + Signed QR) combines visual archival PDF layout with machine-readable payloads.

Core Capabilities

  • PDF/A-1b, PDF/A-2b, and PDF/A-3b: validatePdfA() and enforcePdfA() strip forbidden actions (JavaScript, Launch, external URI), embed uncompressed UTF-8 XMP headers and a synthetic 5-tag sRGB ICC output intent, validate embedded fonts, and permit structured /AFRelationship file attachments cleanly on PDF/A-3b.
  • UN/CEFACT CII XML Builder (buildCiiXml()): Generates Factur-X minimum or en16931 rsm:CrossIndustryInvoice XML from structured invoice data with entity escaping.
  • PDF/A-3b Attachment (attachEInvoice()): Embeds any XML payload into Catalog /Names/EmbeddedFiles and /AF arrays with /AFRelationship (/Data, /Source, /Alternative, /Supplement).
  • Pure-TS ISO-18004 QR & India IRP JWT Verification (qr.ts): parseIndiaIrpQr() decodes IRP JWT payloads, checks Seller/Buyer GSTIN checksums with isValidGstin(), verifies RS256/ES256 signatures when given NIC public keys, and generateQrSvg() outputs crisp vector QR barcodes up to Version 40 without external npm packages.

Complete One-Call Pipeline

const einvoice = await engine.renderEInvoice(invoiceData, htmlTemplate, {
  cii: { profile: 'en16931' },
  indiaQr: {
    irpPayload: signedIrpJwt,
    publicKeyPem: nicPubKey,
    verifySignature: true,
  },
});

Place {{ONEX_QR}} inside your HTML to position the generated SVG QR anywhere cleanly; if omitted, ONEX appends a compact QR block inside <body>, embeds CII XML, converts to PDF/A-3b, and runs a final extraction round-trip audit confirming visual figures match structured fields.

Clone this wiki locally