Class COSDocument

java.lang.Object
org.sejda.sambox.cos.COSBase
org.sejda.sambox.cos.COSDocument
All Implemented Interfaces:
COSObjectable

public class COSDocument extends COSBase
This is the in-memory representation of the PDF document.
Author:
Ben Litchfield
  • Constructor Details

    • COSDocument

      public COSDocument()
    • COSDocument

      public COSDocument(FileTrailer trailer, String headerVersion)
  • Method Details

    • setHeaderVersion

      public void setHeaderVersion(String headerVersion)
      Sets the version of the PDF specification to write to the file header. File header is defined in Chap 7.5.2 of PDF 32000-1:2008
      Parameters:
      headerVersion -
    • getHeaderVersion

      public String getHeaderVersion()
      Returns:
      the version of the PDF specification retrieved from the file header. File header is defined in Chap 7.5.2 of PDF 32000-1:2008
    • isEncrypted

      public boolean isEncrypted()
      Returns:
      true If this document has an encryption dictionary
    • getEncryptionDictionary

      public COSDictionary getEncryptionDictionary()
      Get the encryption dictionary if the document is encrypted or null if the document is not encrypted.
      Returns:
      The encryption dictionary.
    • setEncryptionDictionary

      public void setEncryptionDictionary(COSDictionary dictionary)
      Set the encryption dictionary, this should only be called when encrypting the document.
      Parameters:
      dictionary - The encryption dictionary.
    • getDocumentID

      public COSArray getDocumentID()
    • setDocumentID

      public void setDocumentID(COSArray id)
    • getCatalog

      public COSDictionary getCatalog()
      Returns:
      the catalog for this document
      Throws:
      IllegalStateException - If no catalog can be found.
    • getTrailer

      public FileTrailer getTrailer()
    • accept

      public void accept(COSVisitor visitor) throws IOException
      Description copied from class: COSBase
      Visitor pattern for the COS model objects
      Specified by:
      accept in class COSBase
      Throws:
      IOException