-
-
Save rahmaj/7d5399d9519e9b15682c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.sourceforge.tess4j.Tesseract; | |
import net.sourceforge.tess4j.TesseractException; | |
import net.sourceforge.tess4j.util.PdfUtilities; | |
public class TestOCR { | |
public void performOCR() throws TesseractException { | |
Tesseract instance = Tesseract.getInstance(); | |
File pdfDoc = new File("/my/file/location/doc.pdf"); | |
File pngImageFiles[] = PdfUtilities.convertPdf2Png(pdfDoc); | |
for (int i = 0; i < pngImageFiles.length; i++) { | |
String ocrResult = instance.doOCR(pngImageFiles[i]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment