Invoice & Table Structurer — PDFs to JSON/CSV
Pricing
Pay per usage
Go to Apify Store
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
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
12 days ago
Last modified
Categories
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
| Field | Type | Default | Description |
|---|---|---|---|
startUrls | array of objects | — | Each item: { "fileUrl": "https://.../invoice.pdf" } (local path / file:// works in local run) |
pdfBase64 | string | — | Alternative to startUrls for small PDFs |
docType | auto / invoice / statement / table | invoice | Extraction profile |
maxPages | integer | 20 (cap 100) | Pages to parse |
format | json / csv | json | csv adds a CSV string of the first table |
includePageText | boolean | false | Include 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 installmkdir -p storage/key_value_stores/defaultecho '{"startUrls":[{"fileUrl":"C:/path/to/sample-invoice.pdf"}],"docType":"invoice"}' > storage/key_value_stores/default/INPUT.jsonnode 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.jsonusesactorSpecification: 1(notactorSpecVersion).package.json:main/start=src/main.js.input_schema.json:startUrls.items.type=objectwithfileUrlfield.- 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.jsonare kept in sync for local tooling + platform.
Files
| File | Purpose |
|---|---|
src/main.js | Actor code (Node stdlib + pinned pdfjs-dist, apify SDK) |
input_schema.json | Actor input schema |
.actor/actor.json | Actor definition |
.actor/dataset_schema.json, .actor/output_schema.json | Dataset/output schema |
Dockerfile | Node official image + npm ci --omit=dev + CMD node src/main.js |
sample-invoice.pdf | Local 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.