...
This will extract inline images as if they were attachments, and then, if Tesseract is correctly configured, it should run against the images. Note: by default, extracting inline images is turned off because some rare PDFs contain thousands of inline images per page, and it has a big hit on performance, both memory usage and time.
No Format |
---|
...
<parser class="org.apache.tika.parser.pdf.PDFParser">
<params>
<param name="extractInlineImages" type="bool">true</param>
</params>
</parser
...
|
...
This will render each PDF page and then run OCR on that image. This method of OCR is triggered by the ocrStrategy
parameter, but users can manipulate other parameters, including the image type
(see org.apache.pdfbox.rendering.ImageType
for options) and the dots per inch dpi
. The defaults are: gray
and 300
respectively. For ocrStrategy
, we currently have: no_ocr
(rely on regular text extraction only), ocr_only
(don't bother extracting text, just run OCR on each page), ocr_and_text
(both extract text and run OCR) and (as of Tika 1.21) auto
(try to extract text, but run OCR if fewer than 10 characters were extracted of if there are more than 10 characters with unmapped Unicode values).
No Format |
---|
...
<parser class="org.apache.tika.parser.pdf.PDFParser">
<params>
<param name="ocrStrategy" type="string">ocr_only</param>
<param name="ocrImageType" type="string">rgb</param>
<param name="ocrDPI" type="int">100</param>
</params>
</parser>
...
|
...
Setting Parse Time/Per File configurations via tika-server
See: Configuring Parsers At Parse Time in tika-server.
Optional Dependencies
Note, you should include the following dependency to process JBIG2 images:
No Format |
---|
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>jbig2-imageio</artifactId>
<version>3.0.2</version>
</dependency>
|
Note, if their licenses are compatible with your application, you may want to include the following jai libraries in your classpath to handle jp2, jpeg2000 and tiff files. The licenses are not Apache 2.0 compatible!
No Format |
---|
<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-jpeg2000</artifactId>
<version>1.3.0</version>
<scope>test</scope>
</dependency>
|
...