StatementFlow AI 為何將 PDF 擷取全面移至用戶端,實現零上傳銀行結單解析
Zero-Upload Bank Statement Parsing: Why We Moved PDF Extraction 100% Client-Side
StatementFlow AI 將多頁銀行結單 PDF 解析 100% 移至瀏覽器用戶端,避免客戶的原始 PDF 離開其電腦,以回應財務團隊對資料管治的要求。解析器使用 pdfjs-dist 和本地 Web Worker,按 ±3pt 的 Y 座標容差重組表格行,再以確定性 Decimal(opening + sum == closing) 餘額檢查驗證結果。
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.
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:
- Extract every text item's
(x, y)PDF transform coordinates per page. - Group items into logical table lines using a
±3ptY-coordinate tolerance, then sort strictly left-to-right byx. - 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
- Live Zero-Upload Studio: https://statementflow.win
- 30+ Bank & Accounting Presets: Chase, Mercury, Wise, Payoneer, Airwallex, QuickBooks CSV, Xero CSV
- Open-Source Repo: https://github.com/wangguode/statementflow-ai
來源:DEV Community · dev.to
