Class PdfDocumentReaderConfig

java.lang.Object
org.springframework.ai.reader.pdf.config.PdfDocumentReaderConfig

public final class PdfDocumentReaderConfig extends Object
Common configuration builder for the PagePdfDocumentReader and the ParagraphPdfDocumentReader.
Author:
Christian Tzolov
  • Field Details

    • ALL_PAGES

      public static final int ALL_PAGES
      See Also:
    • reversedParagraphPosition

      public final boolean reversedParagraphPosition
    • pagesPerDocument

      public final int pagesPerDocument
    • pageTopMargin

      public final int pageTopMargin
    • pageBottomMargin

      public final int pageBottomMargin
    • pageExtractedTextFormatter

      public final ExtractedTextFormatter pageExtractedTextFormatter
  • Method Details

    • builder

      public static PdfDocumentReaderConfig.Builder builder()
      Start building a new configuration.
      Returns:
      The entry point for creating a new configuration.
    • defaultConfig

      public static PdfDocumentReaderConfig defaultConfig()
      Returns the default config.
      Returns:
      the default config
    • isPageSelected

      public boolean isPageSelected(int pageNumber)
      Whether the given one-based page number should be read. When no page ranges are configured every page is read; otherwise a page is read when it falls within any of the configured inclusive ranges.
      Parameters:
      pageNumber - the one-based page number
      Returns:
      true if the page should be read
    • hasPageRanges

      public boolean hasPageRanges()
      Whether any page ranges are configured. Readers that do not support page ranges can use this to reject such a configuration instead of silently ignoring it.
      Returns:
      true if at least one page range has been configured