Every tax season, bookkeepers and small business owners hit the same wall: banks lock 12–36 months of historical statements inside PDFs, while existing PDF-to-CSV tools either charge $29/mo+ recurring subscriptions for an annual task or ask you to upload raw financial PII to remote cloud servers.

Meanwhile, throwing bank statements at an LLM creates a worse problem: probabilistic math. Accounting has an exact ground truth — books either balance to the penny or they don't.

Here is the architecture behind Local Bank Statement Reconciler (https://vz-001-reconciler.pages.dev): a pure client-side TypeScript + Vite web app that parses bank PDFs, verifies ledger math deterministically in integer cents, and exports CSV, Excel, and QuickBooks .qbo (OFX) with zero backend servers and $0 hosting cost.

1. Architecture Overview: Why Pure Client-Side Wins on Trust and Cost

Layer Choice Why
PDF Parsing pdfjs-dist (bundled locally) Zero external CDN worker requests; raw PDF bytes never leave browser RAM
Reconciliation Deterministic integer-cents engine Verifies Opening + Credits - Debits == Closing with zero IEEE-754 float drift
Exports Pure JS RFC-4180 CSV, OFX .qbo, SpreadsheetML .xml Zero server dependencies; works offline
Licensing WebCrypto ECDSA P-256 (VZ1.<payload>.<sig>) Offline asymmetric signature verification — zero auth server needed
Hosting & Checkout Cloudflare Pages Free + itch.io $0/mo static hosting with zero-domain external checkout

Even the built-in "Try Built-In Sample Statement (<10s)" button generates a real PDF 1.4 byte stream in memory using TypeScript (new Uint8Array(...) -> File), so a visitor watching F12 -> Network sees literally 0 HTTP requests from click to CSV export.

2. Coordinate Clustering & Multi-Line Row Reconstruction

PDFs don't store tables — they store positioned text runs (str, x, y). Bank statements complicate this in two ways:

  1. Numeric columns may jitter by 1–3 pt vertically relative to the date/description.
  2. Long merchant descriptions wrap onto 2–3 continuation lines below the transaction date.

We normalize every text run through pdfjsLib.Util.transform(viewport.transform, item.transform), cluster rows within an adaptive yTol = clamp(lineHeight * 0.45, 2.0, 5.5), and merge intra-row glyph spans into column tokens. Once header bands (Date, Description, Debit, Credit, Amount, Balance) establish X-coordinate intervals, any subsequent row that lacks a date and numeric amount is stitched onto the preceding transaction's description rather than dropped or emitted as an orphan row.

3. The 0-Glyph Scanned PDF Guard & Integer-Cents Invariant

Two silent failure modes destroy user trust in PDF converters:

  1. Passing an image-only scanned PDF through a text parser -> emitting 0 rows -> computing 0 + 0 - 0 == 0 -> falsely reporting "Reconciled!".
  2. Accumulating floating-point dollars (0.1 + 0.2) and missing penny discrepancies.

Our parser counts selectable non-whitespace glyphs (totalGlyphs) and inspects page.getOperatorList() for image XObjects (paintImageXObject). If totalGlyphs === 0, the UI halts with an actionable warning explaining why we refuse to upload scanned images to a cloud OCR server. All transaction sums run strictly in integer cents (19.99 -> 1999).

4. Offline Asymmetric Licensing via WebCrypto ECDSA P-256

To keep the $19 Pro upgrade 100% offline-capable (no license check-in server, no tracking), the app verifies signed VZ1.<payload_b64u>.<sig_b64u> tokens locally using window.crypto.subtle and an embedded ECDSA P-256 public JWK (x and y coordinates only — no private scalar d ever ships in client code).

Try It & Inspect the Network Tab

  • Live Tool: https://vz-001-reconciler.pages.dev
  • Test in < 10 Seconds: Open F12 -> Network, click "Try Built-In Sample Statement", and verify 0 network requests from parse to CSV export.
  • Pricing: Core single-statement parsing, full balance check, and up to 30 exported CSV rows are $0 forever (no login). A $19 one-time Pro license unlocks unlimited rows, multi-month PDF merging with duplicate/gap detection, Schedule-C categorization, QuickBooks .qbo (OFX), Xero CSV, and a multi-sheet Excel audit workbook.