Why Are All the Amounts Negative? The Invisible Minus Sign in PDFs
Why are all the amounts values negative?

A customer reported that all amounts in a converted bank statement were negative. Investigation revealed the PDF used trailing minus signs, but for positive values, the minus was rendered in the same gray as the background, making it invisible. This hidden character was still extracted by the converter. The post explains the PDF commands involved and offers two fixes: OCR the PDF or strip non-black text, with the latter requiring storing text color during extraction.
The character is there, but it is not visible and that’s why it comes through when my code processes this PDF.
- rmunn
I was expecting something about double-entry accounting and how it can (initially) be non-intuitive whether to mark a given entry as a debit (-100) or credit (+100), especially for liabilities (when you enter a credit card payment in your ledger, the signs aren't what you might intuitively expect when you haven't wrapped your head around the system yet).
Instead I get a nice blog post about a knotty little problem caused by someone's abuse of semantic markup for style purposes. Shows that HTML doesn't have a monopoly on that issue. PDFs are already bad enough as a format for extracting data from, we don't need dumb HTML-inspired tricks on top of that.
Nice job finding the issue and explaining it clearly, OP. Thanks for an interesting writeup.
- deepsun
Why not skipping all the minus signs unless they do not immediately precede a number. I see all the minus signs are after the number, not before, so just skip if they are not before. Preferably in the same BT/ET block as the number.
- happymellon
Does this end on a cliffhanger?
Did they try one method, and what was the feedback?