## TL;DR

E-invoicing mandates are replacing PDF invoices with structured XML (Peppol BIS, Factur-X/ZUGFeRD), which eliminates extraction errors entirely. Agents should prefer the XML attachment when present, validate against the schema, and fall back to PDF OCR only when no structured data exists. Track mandate timelines per country; non-compliant invoicing gets rejected by tax authorities.

## Steps

1. Detect structured attachments (XML) in inbound invoices.
   Expected: A format decision per invoice.
2. Parse and validate against the schema (Peppol BIS, Factur-X).
   Expected: Structured data, no OCR.
3. Use the XML as the source of truth over the PDF visual.
   Expected: Authoritative fields.
4. Fall back to OCR only without structured data.
   Expected: Graceful degradation.
5. Track country mandate deadlines.
   Expected: Compliance calendar.

## When to use

- EU invoicing
- E-invoice mandate compliance
- Structured data intake

## When not to use

- PDF-only vendor bases
- US invoicing (no federal mandate)
- OCR tuning

## Compatibility

Peppol, Factur-X/ZUGFeRD profiles; ERP e-invoice modules.

## Variant phrasings

### Peppol invoice agent

### Factur-X ZUGFeRD processing

### e-invoicing mandate compliance

## Root cause

Structured e-invoices carry machine-readable data by law. OCR on a PDF that has an XML twin is wasted work and added error.

## Edge cases

- Profiles differ (BASIC vs EN 16931); validate the right one
- Some countries mandate clearance models (real-time reporting)
- Hybrid invoices need PDF/XML consistency checks

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_FV_ciUeLy3A8YiTHxaNApw
