views:

1095

answers:

6

Has anybody attempted to extract text from a PDF using an OCR library and Java? What did you find to be the most reliable library for text extraction. Most of the approaches I've seen (tesseract, GOCR) are C libraries that would require some JNI code to be written.

I'm familiar with pdfbox, which is now an Apache incubator project at version 0.8.x, but it's text extraction isn't always accurate. I'm looking for an alternative approach that is somewhat more reliable.

I've not tried Asprise JavaPDF yet, in the process of trying that, but wanted to know more about the OCR approach (if it's possible).

Any help would be appreciated.

+1  A: 

If you want to extract OCR from text based PDF you may have to convert it to an image first.

Otávio Décio
+4  A: 

I've spent way too much time looking for a good library for extracting text from PDFs, both OCR and text-based.

I never found a satisfactory OCR solution. Don't bother with Java OCR. Oh good, it looks like their site is now defunct (hooray). There may be a pure-java commercial solution which works well, I haven't tried many of those.

If you have a text-based PDF, I'd strongly recommend PDFTextStream. It's not free, but licensing is reasonable, and it is much much better than PDFBox. PDFBox chokes on many PDF files which are generated by newer tools, and is not too consistent about PDFs it can handle. PDFTextStream handles any PDF I throw at it, including PDFs with embedded PNG images, which PDFBox can not do.

If you heckle the PDFTextStream folks to add OCR, they may listen up.

Sam Barnum
Thanks, sounds good, pity about the price though...
Jon
A: 

You can use this free online ocr tool, it allows to OCR PDFs

Alex
No, no no no no, read the question
Jon
A: 

You can try http://www.onlinedocumentconversion.com also just register, upload and edit without download or having any PDF editor. This place seems pretty good and affordable at few cents per page after you run out of your Free credits. Considering 24×7 online availability is pretty convenient also.

Monica Sharma
No, no no no no, read the question
Jon
A: 

Check it out, this also is amongst most popular answers at www.askageek.com people are asking.

Lynda
No, no no no no, read the question
Jon
A: 

Its paid site, yet after support is awesome - www.converttoword.com

Maryanna
No, no no no no, read the question
Jon