Menu

Parsing bank statement PDFs in the browser, with a CSP that proves nothing gets uploaded
📰

Parsing bank statement PDFs in the browser, with a CSP that proves nothing gets uploaded

DEV Community: javascript·Brandon Sooknanan·about 24 hours ago
#VMYKWWJT
#devtojavascript#devto#dev#direction#bank
Reading 0:00
15s threshold

People who freelance often can't get a CSV out of their bank. Some banks only give PDF statements, others limit downloads to 90 days, and a few dropped CSV and QFX exports entirely. But every bookkeeping spreadsheet wants rows of Date, Description, Amount .

The usual fix is an online converter, which means uploading a year of bank statements to a stranger's server. I didn't want to ask anyone to do that, so the converter I built for Paid & Filed runs entirely in the browser tab: paidandfiled.com/bank-statement-converter . This post covers the three parts that were harder than I expected.

1. Turning pdf.js text runs back into lines

page.getTextContent() doesn't give you lines. It gives you runs of text, each with a transform matrix, in whatever order the PDF generator wrote them.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.