Invoice & Table Structurer — PDFs to JSON/CSV avatar

Invoice & Table Structurer — PDFs to JSON/CSV

Pricing

Pay per usage

Go to Apify Store
Invoice & Table Structurer — PDFs to JSON/CSV

Invoice & Table Structurer — PDFs to JSON/CSV

Extract invoice fields (number, dates, parties, totals, tax) and rebuild tables from digital PDFs into JSON/CSV. Chinese invoices first. No OCR, explicit warnings on every heuristic.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Tang

Tang

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

12 days ago

Last modified

Features

Limited permissions

Share

Extract invoice fields and tables from digital (text-layer) PDFs into structured JSON/CSV. Deterministic heuristics, Chinese invoice / ledger first. No OCR, no LLM, no external services.

Input

FieldTypeDefaultDescription
startUrlsarray of objects—Each item: { "fileUrl": "https://.../invoice.pdf" } (local path / file:// works in local run)
pdfBase64string—Alternative to startUrls for small PDFs
docTypeauto / invoice / statement / tableinvoiceExtraction profile
maxPagesinteger20 (cap 100)Pages to parse
formatjson / csvjsoncsv adds a CSV string of the first table
includePageTextbooleanfalseInclude raw page text

Example input

{
"startUrls": [{ "fileUrl": "https://example.com/invoice.pdf" }],
"docType": "invoice",
"format": "json"
}

Output (dataset, one record per PDF)

{
"ok": true,
"error": null,
"docType": "invoice",
"pages": [...],
"tables": [ { "rows": [ ["项目", "数量", "金额"], ["..."], ... ] } ],
"fields": {
"发票代码": "044001900111",
"发票号码": "12345678",
"开票日期": "2026年11月10日",
"购买方名称": "桂林星辰科技有限公司",
"购买方税号": "91450300MA5K1234X",
"销售方名称": "南宁云帆信息技术有限公司",
"价税合计": "陆仟壹佰捌拾元整 ¥6180.00"
},
"issues": [],
"warnings": [],
"stats": { "bytes": 78140, "pagesTotal": 1, "pagesParsed": 1, "tables": 1, "fields": 7, "chars": ... }
}

Local run

npm install
mkdir -p storage/key_value_stores/default
echo '{"startUrls":[{"fileUrl":"C:/path/to/sample-invoice.pdf"}],"docType":"invoice"}' > storage/key_value_stores/default/INPUT.json
node src/main.js
# results: storage/datasets/default/*.json

Verified locally with sample-invoice.pdf: exit 0, 7 invoice fields + 1 table extracted (log: logs/run-sample.log).

Limitations

  • Digital PDFs only (must have a text layer). Scanned/image PDFs need OCR — not supported here.
  • No handwriting recognition (handwritten invoice/ledger entries are ignored).
  • No LLM cleanup: field extraction is heuristic + regex; unusual layouts may produce warnings/issues.
  • Max 10 MB per PDF, max 100 pages (hard caps).
  • Chinese invoice layout / common ledger tables are the primary target; other layouts may need tuning.

Platform notes (Apify upload)

  • .actor/actor.json uses actorSpecification: 1 (not actorSpecVersion).
  • package.json: main / start = src/main.js.
  • input_schema.json: startUrls.items.type = object with fileUrl field.
  • When creating/updating the Actor, pass source file contents as plain text, not base64 (Apify platform pitfall).
  • Both input_schema.json (root) and .actor/input_schema.json are kept in sync for local tooling + platform.

Files

FilePurpose
src/main.jsActor code (Node stdlib + pinned pdfjs-dist, apify SDK)
input_schema.jsonActor input schema
.actor/actor.jsonActor definition
.actor/dataset_schema.json, .actor/output_schema.jsonDataset/output schema
DockerfileNode official image + npm ci --omit=dev + CMD node src/main.js
sample-invoice.pdfLocal test fixture

Example output (real run on the bundled sample invoice PDF)

{
"ok": true,
"docType": "invoice",
"fields": {
"发票代码": "...", "发票号码": "...", "开票日期": "...",
"购买方名称": "...", "购买方税号": "...", "销售方名称": "...", "价税合计": "..."
},
"tables": [ { "rows": [ ["项目","数量","金额"], "..." ] } ],
"pages": [ "..." ],
"warnings": [ { "code": "TABLE_LOW_CONFIDENCE", "message": "table confidence 75%" } ],
"stats": { "pages": 1, "tables": 1 }
}

7 invoice fields + 1 reconstructed table.