2

I have an HTML form where a user can upload a PDF.
I want to extract the whole text from the PDF, search in it for specific words and then store them in my database. Any ideas?
I don't ask you for the whole code of course, but something to begin with. Like a library or something like OCR, but free.

3
  • 1
    i work in php . that's why i use that tags
    – martha t
    Nov 13, 2017 at 13:21
  • 1
    Not sure if this is an option in your scenario, but consider distributing fillable PDFs beforehand and then you can easily extract structured data from it. Nov 18, 2017 at 13:28
  • 2
    Why are you thinking of OCR? Aren't these PDFs text? Dec 10, 2018 at 12:44

2 Answers 2

0

If the pdf has been created programmatically, rather than scanned, the python library pdfminer can extract the text for you.

It and python are free, gratis & open source, and are available for most platforms.

2
  • 1
    Thanks for the response! I am afraid that the pdf it's scanned plus i don't know much about Python ! I work mostly in java , c++ , php , html .
    – martha t
    Nov 13, 2017 at 13:23
  • 2
    The problem with scanned pdf files is that basically they are images, with possibly some attempt at OCR. You could look at github.com/tesseract-ocr/tesseract for an Apache Licenced OCR it is C but there are wrappers for python, java and a few others. Nov 13, 2017 at 14:42
0

What about this S.O question ?

The article OCR in PHP: Read Text from Images with Tesseract explains more.

There is a PhpOcr project on SourceForge.

Tesarect would seem to be your best bet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.