Class PagesConfig

java.lang.Object
org.apache.tika.parser.pages.PagesConfig
All Implemented Interfaces:
Serializable

public class PagesConfig extends Object implements Serializable
What a parser does with a document's pages when the document has to be rendered to get pixels: how it renders (render), where a page's text comes from (text), the recognizer budget and verdict (ocr), what is released to inference bindings (inference), and whether renders are emitted as embedded documents (emit). One block for every rendering parser; the PDF parser and the EMF/WMF parsers read it.

Every field is nullable so an instance can be an overlay, and the same class is read at four layers, later ones winning per field: the config's "parse-context": {"pages": ...}, a request's "pages" (which replaces the config's, as every parse-context key does), a parser's own "pages" under "parsers", and that parser's "pages" in the request. resolve(org.apache.tika.parser.ParseContext, org.apache.tika.parser.pages.PagesConfig...) folds them onto defaults().

Since:
Apache Tika 4.1
See Also:
  • Field Details

  • Constructor Details

    • PagesConfig

      public PagesConfig()
  • Method Details

    • defaults

      public static PagesConfig defaults()
      Every field set: default render, AUTO, no OCR budget, TEXT released, nothing emitted.
    • resolve

      public static PagesConfig resolve(ParseContext context, PagesConfig... overlays) throws TikaConfigException, IOException
      The effective block for a parse: defaults(), the context's "pages" (JSON, or a PagesConfig set on the context by class), then each overlay in order.
      Throws:
      TikaConfigException
      IOException
    • over

      public PagesConfig over(PagesConfig overlay)
      A copy of this with every set field of overlay applied; null overlay is this.
    • emittedRender

      public RenderSettings emittedRender()
      The settings emitted renders use: render with emit.render applied.
    • emitsSameImage

      public boolean emitsSameImage()
      Whether emitted renders are the same image as the render OCR and inference see.
    • getRender

      public RenderSettings getRender()
    • setRender

      public void setRender(RenderSettings render)
    • render

      public RenderSettings render()
      The render overlay, created if unset: pages.render().setDpi(96).
    • getText

      public TextPolicy getText()
    • setText

      public void setText(TextPolicy text)
    • getOcr

      public PagesConfig.Ocr getOcr()
    • setOcr

      public void setOcr(PagesConfig.Ocr ocr)
    • ocr

      public PagesConfig.Ocr ocr()
      The OCR overlay, created if unset.
    • getInference

      public List<InputKind> getInference()
    • setInference

      public void setInference(List<InputKind> inference)
      TEXT, PAGES, or both; what the parser releases to inference bindings.
    • getEmit

      public PagesConfig.Emit getEmit()
    • setEmit

      public void setEmit(PagesConfig.Emit emit)
    • emit

      public PagesConfig.Emit emit()
      The emit overlay, created if unset: pages.emit().setEnabled(true).