DEV Community

StructMint
StructMint

Posted on

Shipping a 512 MB text-first PDF table extractor & report-change watcher for n8n/Make

Yesterday I posted an open question asking how n8n and Make builders handle multi-page PDF tables and edition-to-edition report changes without flattening tables into broken text lines or burning LLM tokens on every page.

Instead of leaving that thread purely theoretical, I built and benchmarked a lightweight 512 MB, text-first v1 (LIMITED_PERMISSIONS, no heavy OCR container bloat) and published live synthetic fixtures so anyone can test structured table extraction and cell-level diffing directly.

What breaks in typical PDF automation pipelines

When recurring public PDFs (fee schedules, vendor catalogs, SLA matrices, regulatory bulletins) drop every month or quarter:

  1. Plain text or Markdown converters flatten multi-column grids into single lines.
  2. Sending every page to an LLM on a daily cron introduces both recurring token cost and silent numeric drift.
  3. Even after extraction works, downstream workflows still need to answer: "Did anything actually change since the last edition, and which cells moved?"

Live benchmark on two synthetic multi-page fee schedules (Q4 2026 vs. Q1 2027)

To verify deterministic extraction and cell diffing without touching private documents, I published two public two-page synthetic fee schedule PDFs in our open automation kit:

Observed measurements on 512 MB RAM on Apify Cloud:

Metric Measured result
Local parse (both 2-page PDFs) 143.9 ms, 1.63 MB Python heap peak
Cloud run #1 (extract Q4 baseline + save watch state) 1 dataset item (2 tables, 8 rows), ~$0.00015 platform compute
Cloud run #2 (unchanged Q4 watch check via ETag/SHA-256) 0 dataset items emitted (documentsUnchanged: 1)
Edition diff (Q4 2026 -> Q1 2027) 2 tables changed, 1 row added (Enterprise), 1 row removed (Legacy), 8 exact cell diffs detected

Sample cell changes returned in reportDiff.cellChanges[]:

  • Table #1 (p.1) [Starter / Overage Rate]: $0.0040 / unit -> $0.0045 / unit
  • Table #1 (p.1) [Growth / SLA Uptime]: 99.9% -> 99.95%
  • Table #2 (p.2) [EU-Central / Retention Days]: 180 -> 365
  • Table #2 (p.2) [AP-Southeast / Audit Log]: Optional -> Included

Design choices that keep v1 predictable

  • Structured outputs per table: Every table emits deduplicated headers[], 2D rows[][], database-ready key-value records[], RFC-4180 csv, GFM markdownTable, bounding box, and a tableFingerprint, plus optional page-cited ragChunks[].
  • Text-first honesty (no silent missing pages): v1 intentionally skips heavy 2 GB OCR containers. Any image-only page with fewer than 25 text characters is explicitly flagged in scannedOnlyPages[] and hasScannedOnlyPages: true.
  • Privacy-first watch defaults: By default (storeCellValuesForDiff: false), Watch Mode persists only SHA-256 hashes in your user-scoped Named Key-Value Store (90-day retention) — zero document text is stored. Literal previousValue -> currentValue cell diffs are strictly opt-in for public, non-confidential reports.
  • Complete-scan integrity: If a PDF exceeds maxPagesPerPdf, the run marks extractionComplete: false, suppresses removal counts, and never overwrites a complete baseline.

Pricing and ready-to-import workflows

Usage is billed strictly through Apify Pay-Per-Event with one primary unit (1 emitted PDF = 1 dataset item):

  • Run start: $0.00005
  • Per extracted PDF document: $0.0060 (Free) -> $0.0050 (Bronze) -> $0.0045 (Silver) -> $0.0040 (Gold+)
  • Minimum configurable cap: $0.01
  • Unchanged Watch runs (onlyChanged: true): emit 0 dataset items (only the $0.00005 start fee applies)

Links to inspect or import directly:

If you have a public, non-confidential text-based PDF whose table layout breaks standard parsers, drop the URL on the GitHub RFC thread — I am actively benchmarking edge cases through December 19.

Top comments (0)