跳到正文
DEV Community· 王果ai·· 21 小時前AI 評分41

StatementFlow AI 為何將 PDF 擷取全面移至用戶端,實現零上傳銀行結單解析

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

AI 導讀

StatementFlow AI 將多頁銀行結單 PDF 解析 100% 移至瀏覽器用戶端,避免客戶的原始 PDF 離開其電腦,以回應財務團隊對資料管治的要求。解析器使用 pdfjs-dist 和本地 Web Worker,按 ±3pt 的 Y 座標容差重組表格行,再以確定性 Decimal(opening + sum == closing) 餘額檢查驗證結果。

正文

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

王果ai

王果ai

Posted on Nov 21 Edited on Nov 21

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

來源:DEV Community · dev.to