Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9, 1.10
    • Fix Version/s: None
    • Component/s: config, parser
    • Labels:
    • Environment:

      Windows 7, 64-bit, JDK 1.8.0_51 64-bit
      Windows 10, 64-bit, JDK 1.8.0_51 32-bit

      Description

      As described in this stackoverflow-post i'm having troubles extracting text out of scanned PDF files. By scanned PDF files i mean PDF files that consist only of images. Because each page is an image i can't extract them using a custom ParsingEmbeddedDocumentExtractor. I also tried using the setExtractInlineImages method of the PDFParserConfig but this didn't work aswell.
      There was already a ticket regarding the OCR support and including the PDF file i'm using for my tests.
      Here is a JUnit-test about my issue:

      PDFOCRTest.java
      @Test
      public void testPDFOCRExtraction() throws IOException, SAXException, TikaException {
      	File file = new File(filePath);
      	InputStream stream = new FileInputStream(file);
      	
      	BodyContentHandler handler = new BodyContentHandler(Integer.MAX_VALUE);
      	Metadata metadata = new Metadata();
      	PDFParserConfig config = new PDFParserConfig();
      	config.setExtractInlineImages(true);
      	ParseContext context = new ParseContext();
      	context.set(PDFParserConfig.class, config);
      	
      	PDFParser pdfParser = new PDFParser();
      	pdfParser.setPDFParserConfig(config);
      	pdfParser.parse(stream, handler, metadata, context);
      	String text = handler.toString().trim();
      	assertFalse(text.isEmpty());
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lorisbachert Loris Bachert
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: