DEV Community

PatrickPi1312
PatrickPi1312

Posted on • Originally published at extract.installateur1210.at

Turn a PDF invoice into structured JSON — then into a valid XRechnung

Here's a problem millions of small businesses hit in 2026: their old software only prints PDF invoices, but the law increasingly requires a structured e-invoice (XRechnung, ZUGFeRD, Peppol). You can bridge that gap in two API calls: extract the PDF into data, then generate a compliant e-invoice.

Step 1 — PDF (or photo) → structured JSON

Send the document to the extraction endpoint and get back the fields — merchant, date, currency, totals and line items:

curl -X POST "https://extract.installateur1210.at/v1/extract" \
  -H "X-API-Key: YOUR_KEY" \
  -F "file=@invoice.pdf"
Enter fullscreen mode Exit fullscreen mode
{
  "merchant": "ACME GmbH",
  "date": "2026-07-12",
  "currency": "EUR",
  "subtotal": 100.00, "tax": 20.00, "total": 120.00,
  "line_items": [{ "description": "Consulting", "quantity": 1, "amount": 100.00 }]
}
Enter fullscreen mode Exit fullscreen mode

It's AI-based, so review the result before you rely on it — layouts vary.

Step 2 — JSON → valid XRechnung / Peppol

Feed those fields into the e-invoice generator and get a compliant EN 16931 XML (validated ACCEPTABLE by the official KoSIT validator):

curl -X POST "https://einvoice.installateur1210.at/v1/einvoice/generate?key=demo" \
  -H "Content-Type: application/json" \
  -d '{"invoice_number":"AT-2026-001","issue_date":"2026-07-12","currency":"EUR",
       "seller":"ACME GmbH","seller_country":"AT",
       "buyer":"Client Ltd","buyer_country":"DE",
       "total_net":100,"tax_amount":20,"total_gross":120,
       "line_items":[{"name":"Consulting","quantity":1,"line_amount":100}]}'
Enter fullscreen mode Exit fullscreen mode

The whole point

Old PDF-only billing tool on one end, EU e-invoicing mandate on the other — and a two-step pipeline in between: PDF → JSON → XRechnung. Both APIs are EU-hosted and store no document data. Extraction needs its own key (free tier available); the e-invoice API has a public demo key demo.

Examples: https://github.com/PatrickPi1312/xrechnung-api-examples

Top comments (0)