Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDF Text Extraction Approach Using OCR [closed]

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.

like image 928
Jon Avatar asked Apr 22 '09 16:04

Jon


2 Answers

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.

like image 130
Sam Barnum Avatar answered Sep 20 '22 01:09

Sam Barnum


We use ABBYY FineReader Engine 11. They have java wrapper.

Pros:

  • It works great with all the languages (English, Russian, Uzbek etc) and doing real OCR (even if you have pdf without OCR they perform rendering at first and OCRing).

Cons:

  • It costs. You have to buy developer license and end-user license.

  • And it is EXTREMELY slow.

like image 44
Andrew Avatar answered Sep 19 '22 01:09

Andrew