Class PdfSource

java.lang.Object
com.inet.pdfc.config.PdfSource
All Implemented Interfaces:
Serializable, Comparable<PdfSource>
Direct Known Subclasses:
ArrayPdfSource, FilePdfSource

@JsonData public abstract class PdfSource extends Object implements Comparable<PdfSource>, Serializable
This is an abstraction for raw PDF documents. It provides access to the raw content of the document as well as the most basic meta data.
Since:
3.0
See Also:
  • Field Details

  • Constructor Details

    • PdfSource

      public PdfSource()
      Deprecated.
      As of i-net PDFC 23.10 - use the protected constructor PdfSource(String, String, long, long) instead
      Creates an empty document with no name, no path, a size of 0 bytes and a last modified of 1st of January 1970.
      Since:
      3.0
    • PdfSource

      protected PdfSource(String name, String path, long lastModified, long size)
      Creates the document source instance
      Parameters:
      name - the name of the document (usually the file name, not the title set in the meta data of the document)
      path - the path of the document
      lastModified - the last modified time stamp
      size - the size in bytes
      Since:
      23.10
  • Method Details

    • setLanguage

      public void setLanguage(String language)
      Set the language for this document
      Parameters:
      language - the language for this document
      Since:
      5.0
    • getLanguage

      public String getLanguage()
      Return the language for this document
      Returns:
      the language for this document
      Since:
      5.0
    • setPageLimit

      public void setPageLimit(int pageLimited)
      Set the maximal number of pages the document source will return
      Parameters:
      pageLimited - the maximum number of pages to read, if >=0, there will be no limit
      Since:
      4.0
    • getName

      public String getName()
      Returns the name of the PDF document. This may be the original file name for instance of the name provided in the meta data of the document. It will be used to reference the document in reports or log output.
      Returns:
      the name of the document, never null
      Since:
      3.0
    • getPath

      public String getPath()
      Get the path of this document, if one exist. If no existing path, it give null back.
      Returns:
      return the path of the document or null if no path exist
      Since:
      4.0
    • getLastModified

      public long getLastModified()
      Returns the time of the last modification to the document. It's only used for report generation an has no impact on the comparison.
      Returns:
      the last modified timestamp of the document; interpreted as milliseconds since the beginning of 1970
      Since:
      3.0
    • getSize

      public long getSize()
      Returns the size of the raw data in bytes
      Returns:
      the size of the raw data in bytes
      Since:
      3.0
    • getContent

      public abstract com.inet.persistence.RandomAccessRead getContent() throws IOException
      Returns the readable content of this document source
      Returns:
      the readable content of this document source
      Throws:
      IOException - thrown in case the source data cannot be accessed or does not exist
      Since:
      21.10
    • getPassword

      public String getPassword()
      Returns the user password to decode the PDF source
      Returns:
      the user password, may be null for none
      Since:
      3.0
    • setPassword

      public void setPassword(String password)
      Sets the user password to decode the PDF source
      Parameters:
      password - the user password, may be null for none
      Since:
      3.0
    • getMetaProperties

      protected Map<String,String> getMetaProperties()
      Returns the meta properties map to store any additional information to. Please consider using this map instead of instance fields for additional information.
      Returns:
      the meta properties, not null
      Since:
      4.0
    • compareTo

      public int compareTo(PdfSource o)
      Specified by:
      compareTo in interface Comparable<PdfSource>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object