Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

Zero-Upload Bank Statement Parsing: Why We Moved PDF Extraction 100% Client-Side

The #1 objection we heard from bookkeepers and fractional CFOs when testing AI bank-statement converters wasn't accuracy—it was data governance: "I cannot upload my client's 12-month Chase or Mercury PDF statements t

Zero-Upload Bank Statement Parsing: Why We Moved PDF Extraction 100% Client-Side

The #1 objection we heard from bookkeepers and fractional CFOs when testing AI bank-statement converters wasn't accuracy—it was data governance:

"I cannot upload my client's 12-month Chase or Mercury PDF statements to a random startup's backend server."

Even if you promise not to store uploaded files, compliance-conscious finance teams rightly refuse to send raw financial PDFs over the wire unless there is a strict enterprise DPA.

So in StatementFlow AI (live at statementflow.win), we moved multi-page PDF parsing 100% client-side in the browser.

StatementFlow AI Deterministic Architecture

How Client-Side Coordinate Reconstruction Works

Most naive browser PDF parsers fail on bank statements because PDF streams don't store "table rows"—they store positioned text fragments (x, y, str). If you just concatenate str tokens, dates, descriptions, and dollar amounts drift out of alignment.

Inside src/lib/client-pdf.ts, we use pdfjs-dist with a local Web Worker (/pdf.worker.min.mjs) to:

  1. Extract every text item's (x, y) PDF transform coordinates per page.
  2. Group items into logical table lines using a ±3pt Y-coordinate tolerance, then sort strictly left-to-right by x.
  3. Feed the reconstructed rows into our zero-key heuristic parser and deterministic Decimal(opening + sum == closing) balance gate—without a single byte of the client's PDF leaving their laptop.

Try It With Your Own Statement

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.