[ 
https://issues.apache.org/jira/browse/TIKA-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14012452#comment-14012452
 ] 

Tyler Palsulich commented on TIKA-93:
-------------------------------------

Thanks for the help! I applied the patch. But, there are two copies of each 
class in the patch. Is that intentional? I just deleted one of the copies. I 
installed Tesseract and added the TesseractOCRParser to the META-INF file, but 
OCR isn't running on the example PDF. Should I be using an AutoDetectParser? I 
put my parse-only test below (I put testOCR.pdf in test-documents/ocr/ since it 
was messing with PDFParserTest.)

{code}
    @Test
    public void testPDFOCR() throws Exception {
        Parser parser = new AutoDetectParser();
        BodyContentHandler handler = new BodyContentHandler();
        Metadata metadata = new Metadata();

        TesseractOCRConfig config = new TesseractOCRConfig();   // Have 
Tesseract on my PATH.
        ParseContext parseContext = new ParseContext();
        parseContext.set(TesseractOCRConfig.class, config);

        InputStream stream = TesseractOCRTest.class.getResourceAsStream(
                "/test-documents/ocr/testOCR.pdf");

        try {
            parser.parse(stream, handler, metadata, parseContext);
        } finally {
            stream.close();
        }
    }
{code}

> OCR support
> -----------
>
>                 Key: TIKA-93
>                 URL: https://issues.apache.org/jira/browse/TIKA-93
>             Project: Tika
>          Issue Type: New Feature
>          Components: parser
>            Reporter: Jukka Zitting
>            Assignee: Chris A. Mattmann
>            Priority: Minor
>             Fix For: 1.6
>
>         Attachments: TIKA-93.patch, TIKA-93.patch, TIKA-93.patch, 
> TIKA-93.patch, TesseractOCRParser.patch, TesseractOCRParser.patch, 
> testOCR.docx, testOCR.pdf, testOCR.pptx
>
>
> I don't know of any decent open source pure Java OCR libraries, but there are 
> command line OCR tools like Tesseract 
> (http://code.google.com/p/tesseract-ocr/) that could be invoked by Tika to 
> extract text content (where available) from image files.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to