简体   繁体   中英

How to read content of scanned pdf file in java / jsp or in javascript

How can i read content of scanned pdf file in java/jsp or in javascript, can you tell how to achieve this with developing code?

advance thanks for reply

You can convert the scanned PDF to a image using GhostScript and then feed it to an OCR engine, such as Tesseract . Take a look at VietOCR for an example implementation.

Google对于任何与OCR相关的内容,最好的选择是使用现有的库,例如http://asprise.com/product/ocr/index.php?lang=java

What you are trying to do (I think) is use OCR to extract text from a image PDF produced by a scanner. Java is probably the best for doing this. There are a number of options for doing this, depending on whether you are prepared to pay for software to do this. Google for Java (or Javascript), PDF and OCR.

IMO, this task is not something that should be done in a JSP. JSPs are best for rendering results ... not for generating them in the first place.

Actually, I am working on the same project at the moment, I am doing this in the following steps and the result works well.

  1. User upload a scanned pdf to PDFUploader servlet, returns a server side file name to front end, which indicates upload is successful.
  2. Front end uses this file name and default page 0 to ask PDFReader servlet to retrieve the first page of pdf file and display is at the front end, you can convert this pdf to a image for use an iframe to have the embedded pdf reader.
  3. Front end uses this file name and default page 0 to ask OCRServlet to perform OCR. I am using WeOCR and tesseract as my OCR engine in an Apache http server. I have modified some parts of the submit.cgi in WeOCR server since I know what types of the format that the WeOCR server will receive. I still have some problems while I convert the scanned pdf to an image (I am using pdfbox )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM