Extract invoice fields locally with a review screen before saving
At a glance
An indie developer describes a local PDF-to-JSON invoice pipeline that requires users to check extracted fields before storage. This workflow is listed under Document Processing, Local AI, Invoices.
- Agents / tools
- Qwen2.5 1.5B, pdfjs-dist, node-llama-cpp, SQLite, Electron
SourceBuilding a tool for these workflows? See weekly rates.
What they did
1) Setup: Use a Node.js/Electron environment with pdfjs-dist, node-llama-cpp, a local four-bit GGUF Qwen2.5 1.5B model, a selectable-text invoice PDF, and SQLite storage. 2) Extract text page by page with pdfjs-dist, preserving the line structure for the model. 3) Give the local model the extracted text and a JSON schema covering vendor, invoice number, invoice date, due date, currency, subtotal, tax, total, and line items containing description, quantity, unit price, and amount. Require JSON-only output, use temperature 0.1–0.2, and limit output tokens. 4) Finish: Present the fields in an editable review screen against the invoice. Let the user correct, reject, or confirm the extraction, then save the confirmed record to SQLite.
Worth knowing
The developer identifies blurry scans, unusual layouts, currency ambiguity, and invented fields as failure modes; critical totals still need verification.