java.lang.Object
com.norconex.importer.handler.parser.impl.OcrConfig

public class OcrConfig extends Object

OCR configuration details. OCR relies the open-source Tesseract OCR product to be already installed on your system.

You can configure this parser to use the Tesseract open-source OCR application to extract text out of images or documents containing embedded images (e.g. PDF). Supported image formats are TIFF, PNG, JPEG, GIF, and BMP.

To enable this feature, you must first download and install a copy of Tesseract appropriate for your platform (supported are Linux, Windows, Mac and other platforms). It will only be activated once you configure the path to its install location. Default language detection is for English. To support additional or different languages, you can provide a list of three-letter ISO-639-2 language codes supported by Tesseract (separated with + sign). These languages must be part of your Tesseract installation. You can download additional languages form the Tesseract web site.

When enabled, OCR is attempted on all supported image formats. To limit OCR to a subset of document content types, configure the corresponding content-types (e.g. application/pdf, image/tiff, image/png, etc.).

Tesseract Parameters

Unless disabled, Tesseract is detected and used by default. You can There are several extra parameters one can set to configure Tesseract. You can find a listing here.

See Also:
  • Constructor Details

    • OcrConfig

      public OcrConfig()
  • Method Details

    • setContentTypeMatcher

      public OcrConfig setContentTypeMatcher(TextMatcher contentTypeMatcher)
      The matcher of content types to apply OCR on.
      Parameters:
      contentTypeMatcher - content type matcher
      Returns:
      this
    • isDisabled

      public boolean isDisabled()
    • getContentTypeMatcher

      public TextMatcher getContentTypeMatcher()
    • getApplyRotation

      public Boolean getApplyRotation()
    • getColorSpace

      public String getColorSpace()
    • getDensity

      public Integer getDensity()
    • getDepth

      public Integer getDepth()
    • getEnableImagePreprocessing

      public Boolean getEnableImagePreprocessing()
    • getFilter

      public String getFilter()
    • getImageMagickPath

      public Path getImageMagickPath()
    • getLanguage

      public String getLanguage()
    • getMaxFileSizeToOcr

      public Long getMaxFileSizeToOcr()
    • getMinFileSizeToOcr

      public Long getMinFileSizeToOcr()
    • getPageSegMode

      public String getPageSegMode()
    • getPageSeparator

      public String getPageSeparator()
    • getPreserveInterwordSpacing

      public Boolean getPreserveInterwordSpacing()
    • getResize

      public Integer getResize()
    • getSkipOcr

      public Boolean getSkipOcr()
    • getTessdataPath

      public Path getTessdataPath()
    • getTesseractPath

      public Path getTesseractPath()
    • getTimeoutSeconds

      public Integer getTimeoutSeconds()
    • setDisabled

      public OcrConfig setDisabled(boolean disabled)
      Returns:
      this.
    • setApplyRotation

      public OcrConfig setApplyRotation(Boolean applyRotation)
      Returns:
      this.
    • setColorSpace

      public OcrConfig setColorSpace(String colorSpace)
      Returns:
      this.
    • setDensity

      public OcrConfig setDensity(Integer density)
      Returns:
      this.
    • setDepth

      public OcrConfig setDepth(Integer depth)
      Returns:
      this.
    • setEnableImagePreprocessing

      public OcrConfig setEnableImagePreprocessing(Boolean enableImagePreprocessing)
      Returns:
      this.
    • setFilter

      public OcrConfig setFilter(String filter)
      Returns:
      this.
    • setImageMagickPath

      public OcrConfig setImageMagickPath(Path imageMagickPath)
      Returns:
      this.
    • setLanguage

      public OcrConfig setLanguage(String language)
      Returns:
      this.
    • setMaxFileSizeToOcr

      public OcrConfig setMaxFileSizeToOcr(Long maxFileSizeToOcr)
      Returns:
      this.
    • setMinFileSizeToOcr

      public OcrConfig setMinFileSizeToOcr(Long minFileSizeToOcr)
      Returns:
      this.
    • setPageSegMode

      public OcrConfig setPageSegMode(String pageSegMode)
      Returns:
      this.
    • setPageSeparator

      public OcrConfig setPageSeparator(String pageSeparator)
      Returns:
      this.
    • setPreserveInterwordSpacing

      public OcrConfig setPreserveInterwordSpacing(Boolean preserveInterwordSpacing)
      Returns:
      this.
    • setResize

      public OcrConfig setResize(Integer resize)
      Returns:
      this.
    • setSkipOcr

      public OcrConfig setSkipOcr(Boolean skipOcr)
      Returns:
      this.
    • setTessdataPath

      public OcrConfig setTessdataPath(Path tessdataPath)
      Returns:
      this.
    • setTesseractPath

      public OcrConfig setTesseractPath(Path tesseractPath)
      Returns:
      this.
    • setTimeoutSeconds

      public OcrConfig setTimeoutSeconds(Integer timeoutSeconds)
      Returns:
      this.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object