Puzzling PDF

Emile van Sebille emile at fenx.com
Sun Feb 16 11:29:11 EST 2014


You
On 2/16/2014 6:00 AM, F.R. wrote:
> Hi all,
>
> Struggling to parse bank statements unavailable in sensible
> data-transfer formats, I use pdftotext, which solves part of the
> problem. The other day I encountered a strange thing, when one single
> figure out of many erroneously converted into letters. Adobe Reader
> displays the figure 50'000 correctly, but pdftotext makes it into
> "SO'OOO" (The letters "S" as in Susan and "O" as in Otto). One would
> expect such a mistake from an OCR. However, the statement is not a scan,
> but is made up of text. Because malfunctions like this put a damper on
> the hope to ever have a reliable reader that doesn't require
> time-consuming manual verification, I played around a bit and ended up
> even more confused: When I lift the figure off the Adobe display (mark,
> copy) and paste it into a Python IDLE window, it is again letters (ascii
> 83 and 79), when on the Adobe display it shows correctly as digits. How
> can that be?
>


I've also gotten inconsistent results using various pdf to text 
converters[1], but getting an explanation for pdf2totext's failings here 
isn't likely to happen.  I'd first try google doc's on-line conversion 
tool to see if you get better results.  If you're lucky it'll do the job 
and you'll have confirmation that better tools exist.  Otherwise, I'd 
look for an alternate way of getting the bank info than working from the 
pdf statement.  At one site I've scripted firefox to access the bank's 
web based inquiry to retrieve the new activity overnight and use that to 
complete a daily bank reconciliation.

HTH,

Emile


[1] I wrote my own once to get data out of a particularly gnarly EDI 
specification pdf.







More information about the Python-list mailing list