{"slug": "pdf-invoice-extraction-keep-real-zeros-and-review-missing-fields", "title": "PDF invoice extraction: keep real zeros and review missing fields", "summary": "A developer outlined a workflow for handling missing and zero-value fields in PDF invoice extraction, arguing that a missing field, an empty string, and a real zero must stay distinct so downstream payment scheduling never invents data. In a sample layout extraction, the tool returned invoice number INV-711 and amount USD 0.00 with page-1 grounding, while an absent purchase order came back as an empty string with an empty bounding-box array. The developer warned against truthiness checks like `amount || null` that erase legitimate zeros, and recommended routing unverified, unspecified, missed, or conflicting fields to a human review queue before anything is scheduled.", "body_md": "An invoice has a date and a total, but no due date comes back from your extractor. Adding 30 days to the invoice date would invent a payment term. Before any reminder or payment is scheduled, the workflow needs to know what the invoice actually says.\n\nSave the raw value, the normalized value if you have one, and the reason for review. A missing field, an empty string, and a real zero should stay distinct throughout the workflow.\n\n| What you know | What to do | \n|---|---|\n| Nobody has checked the source | Leave the field unverified and send it for a source check. | \n| The source gives no due date | Record it as unspecified; leave the payment date unset. | \n| The date is visible but the extractor missed it | Ask the reviewer to confirm the value against the source. | \n| The invoice gives two conflicting dates | Keep both dates and their locations for review. | \n\nIn [ComPDF Intelligent Document Extraction](https://www.compdf.com/ai/intelligent-document-extraction?utm_source=devto&utm_medium=community&utm_campaign=pdf_document_workflow_202610&utm_content=devto_invoice_field_review_20261120), request the fields your workflow needs. If you're building a payment review queue, start with the invoice number, amount due, and due date. Request source grounding where supported, and attach the page reference when the response includes one. Without a location, give the reviewer the original PDF to check.\n\nOn one synthetic invoice, a layout extraction request returned `INV-711` and `USD 0.00`, both located on page 1. The invoice didn't give a purchase order number; that field returned an empty string and an empty `bboxes` array. The [response structure guide](https://www.compdf.com/guides/api-reference/v2/ai/extract-guide/response-structure) explains the value and grounding fields.\n\n*Values and source references from one layout extraction result. An empty field on a different invoice still needs a source check.*\n\nAvoid a truthiness check on the normalized amount. Once parsed, `0` is a legitimate number; a JavaScript expression such as `amount || null` would erase it. The review reasons in the table are decisions made by the application or a reviewer; they don't come back as statuses from the extraction API.\n\nUse fictional data. Put each sample on a separate one-page PDF. For B, first omit the due date from a mocked response so you can reproduce the missed-field case on demand. Run a separate pass against real PDFs to see what your extractor actually returns.\n\n| Sample | Source text | Check in your application | \n|---|---|---|\n| A | Due: 2027-03-15 · Amount due: USD 0.00 | Keep the date and the zero. | \n| B | Due: 2027-03-18 · Amount due: USD 120.00 | If the response omits the date, leave it unverified until someone checks the source. | \n| C | Amount due: USD 120.00 | After checking the source, record that no due date was specified. | \n| D | Due: 2027-03-20 · Payment note: due 2027-03-27 | Preserve both candidates and ask for a decision. | \n\nBefore letting the workflow schedule anything, open the review queue. For each unresolved item, check whether the reviewer can see why it was flagged and where to look. If they can't tell the difference between a blank, a missed value, and two conflicting dates, keep that item out of automatic scheduling.", "url": "https://wpnews.pro/news/pdf-invoice-extraction-keep-real-zeros-and-review-missing-fields", "canonical_source": "https://dev.to/derek-compdf/pdf-invoice-extraction-keep-real-zeros-and-review-missing-fields-288d", "published_at": "2026-11-20 02:07:19+00:00", "updated_at": "2026-11-20 02:13:12.703845+00:00", "lang": "en", "topics": ["ai-tools", "structured-data", "ai-products"], "entities": ["ComPDF", "ComPDF Intelligent Document Extraction"], "also_reported_by": [], "takeaway": "Keep raw value, normalized value, and review reason separate for each extracted field, and avoid truthiness checks like `amount || null` that silently erase a legitimate zero.", "recommendation": {"advice": "Store raw and normalized values plus a review reason per field, and route missing, unspecified, missed, or conflicting values to human review before scheduling any payment.", "playbook": "output-verification", "playbook_url": "https://wpnews.pro/playbooks/output-verification"}, "alternates": {"html": "https://wpnews.pro/news/pdf-invoice-extraction-keep-real-zeros-and-review-missing-fields", "markdown": "https://wpnews.pro/news/pdf-invoice-extraction-keep-real-zeros-and-review-missing-fields.md", "text": "https://wpnews.pro/news/pdf-invoice-extraction-keep-real-zeros-and-review-missing-fields.txt", "jsonld": "https://wpnews.pro/news/pdf-invoice-extraction-keep-real-zeros-and-review-missing-fields.jsonld"}}