Class PdfDocument

java.lang.Object
com.northconcepts.datapipeline.pdf.PdfDocument
All Implemented Interfaces:
AutoCloseable

public class PdfDocument extends Object implements AutoCloseable
A PDF file or stream whose tables are extracted from every page when it is opened, for reading with a PdfReader. It cannot be opened again once closed.
  • Constructor Details

    • PdfDocument

      @Deprecated public PdfDocument(File file)
      Deprecated.
      use open(File file)
    • PdfDocument

      @Deprecated public PdfDocument(File file, String password)
      Deprecated.
      use open(File file, String password)
    • PdfDocument

      public PdfDocument()
      Creates an unopened document; load it with one of the open methods.
  • Method Details

    • open

      public PdfDocument open(File file)
      Loads the PDF file and extracts its tables.
    • open

      public PdfDocument open(File file, String password)
      Loads the PDF file using the password (null for none) and extracts its tables.
    • open

      public PdfDocument open(InputStream inputStream)
      Loads the PDF from the stream and extracts its tables.
    • open

      public PdfDocument open(InputStream inputStream, String password)
      Loads the PDF from the stream using the password (null for none) and extracts its tables.
    • open

      @Deprecated public PdfDocument open()
      Deprecated.
      use open(File file) or open(InputStream inputStream)
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • getTableCount

      public int getTableCount()
      Returns the number of tables extracted from the document (0 before it is opened or after it is closed).
    • getFile

      public File getFile()
      Returns the file the document was loaded from or null if it was loaded from a stream or not loaded yet.
    • getDocumentStatistics

      public PdfDocumentStatistics getDocumentStatistics()
      Returns the page, image and text statistics (computed once, then cached) or null if none are cached and the document is not open.