Class PDFDict

java.lang.Object
com.datalogics.PDFL.PDFObject
com.datalogics.PDFL.PDFDict

public class PDFDict extends PDFObject
Represents an associative collection of data elements within a PDF document. All objects in a PDF document are built from a collection of simpler objects that represent fundamental datatypes like numbers, strings and arrays. PDFObject and its subclasses allow direct access and manipulation of these simple objects. Some subclasses represent single data elements, such as PDFInteger, which represents a single integer value. Other subclasses represent a collection of PDFObjects, like PDFArray, an indexed array of data elements.

A PDFDict is a heterogenous collection object that maps other PDFObjects (including other PDFDicts) to PDFName objects.

  • Constructor Details

    • PDFDict

      public PDFDict(Document doc, boolean indirect)
      General constructor

      Parameters:
      doc - Document object containing this PDFDict
      indirect - flag marking this as an indirect PDFObject
    • PDFDict

      public PDFDict(PDFObject docFromObj, boolean indirect)
      General constructor

      Parameters:
      docFromObj - The new PDFArray will be created in the same document as this object.
      indirect - flag marking this as an indirect PDFObject
  • Method Details

    • delete

      public void delete()
      Overrides:
      delete in class PDFObject
    • toString

      public String toString()
      Overrides:
      toString in class PDFObject
    • get

      public PDFObject get(PDFName key)
      Returns the object matching the given key.

      Parameters:
      key - A PDFName for the key
      Returns:
      A PDFObject matching the key
    • get

      public PDFObject get(String key)
      Returns the object matching the given key string.

      Parameters:
      key - A string representing the name for the key
      Returns:
      A PDFObject matching the key
    • put

      public void put(PDFName key, PDFObject obj)
      Puts an object with the matching key into the dictionary, adding the entry if the key is not already present.

      Parameters:
      key - A PDFName for the key
      obj - A PDFObject to add to the dictionary
    • put

      public void put(String key, PDFObject obj)
      Puts an object with the matching key string into the dictionary, adding the entry if the key is not already present.

      Parameters:
      key - A string representing the name for the key
      obj - A PDFObject to add to the dictionary
    • remove

      public void remove(PDFName key)
      Removes a key/object pair from the dictionary.

      Parameters:
      key - A PDFName for the key
    • remove

      public void remove(String key)
      Removes a key/object pair from the dictionary.

      Parameters:
      key - A string representing the name for the key
    • contains

      public boolean contains(PDFName key)
      Tests whether the given key exists in the dictionary

      Parameters:
      key - A PDFName for the key
      Returns:
      true if the given key exists
    • contains

      public boolean contains(String key)
      Tests whether the given key exists in the dictionary

      Parameters:
      key - A string representing the name for the key
      Returns:
      true if the given key exists
    • getKeys

      public List<PDFObject> getKeys()
      Get a list of all keys in the dictionary

      Returns:
      a list of all the keys
    • getXMPMetadata

      public String getXMPMetadata()
      The XMP metadata associated with this dictionary.

      NULL if there is no such data.

      Note: PDFL will not attempt to verify that obj is one of the objects specified to allow XMP metadata by the PDF reference.

    • setXMPMetadata

      public void setXMPMetadata(String metadata)
      The XMP metadata associated with this dictionary.

      NULL if there is no such data.

      Note: PDFL will not attempt to verify that obj is one of the objects that is specified in the PDF reference to allow XMP metadata.