Class PdfDictionary

    • Field Detail

      • FONT

        public static final PdfName FONT
        This is a possible type of dictionary
      • OUTLINES

        public static final PdfName OUTLINES
        This is a possible type of dictionary
      • PAGE

        public static final PdfName PAGE
        This is a possible type of dictionary
      • PAGES

        public static final PdfName PAGES
        This is a possible type of dictionary
      • CATALOG

        public static final PdfName CATALOG
        This is a possible type of dictionary
      • dictionaryType

        private PdfName dictionaryType
        This is the type of this dictionary
      • hashMap

        protected java.util.HashMap hashMap
        This is the hashmap that contains all the values and keys of the dictionary
    • Constructor Detail

      • PdfDictionary

        public PdfDictionary()
        Constructs an empty PdfDictionary-object.
      • PdfDictionary

        public PdfDictionary​(PdfName type)
        Constructs a PdfDictionary-object of a certain type.
        Parameters:
        type - a PdfName
    • Method Detail

      • toPdf

        public void toPdf​(PdfWriter writer,
                          java.io.OutputStream os)
                   throws java.io.IOException
        Returns the PDF representation of this PdfDictionary.
        Overrides:
        toPdf in class PdfObject
        Parameters:
        writer - for backwards compatibility
        os - the outputstream to write the bytes to.
        Throws:
        java.io.IOException
      • put

        public void put​(PdfName key,
                        PdfObject object)
        Adds a PdfObject and its key to the PdfDictionary.
        Parameters:
        key - key of the entry (a PdfName)
        value - value of the entry (a PdfObject)
      • putEx

        public void putEx​(PdfName key,
                          PdfObject value)
        Adds a PdfObject and its key to the PdfDictionary. If the value is null it does nothing.
        Parameters:
        key - key of the entry (a PdfName)
        value - value of the entry (a PdfObject)
      • putDel

        public void putDel​(PdfName key,
                           PdfObject object)
        Adds a PdfObject and its key to the PdfDictionary. If the value is null the key is deleted.
        Parameters:
        key - key of the entry (a PdfName)
        value - value of the entry (a PdfObject)
      • remove

        public void remove​(PdfName key)
        Removes a PdfObject and its key from the PdfDictionary.
        Parameters:
        key - key of the entry (a PdfName)
      • get

        public PdfObject get​(PdfName key)
        Gets a PdfObject with a certain key from the PdfDictionary.
        Parameters:
        key - key of the entry (a PdfName)
        Returns:
        the previous PdfObject corresponding with the key
      • getDirectObject

        public PdfObject getDirectObject​(PdfName key)
        Returns the PdfObject associated to the specified key, resolving a possible indirect reference to a direct object. This method will never return a PdfIndirectReference object.
        Parameters:
        key - A key for the PdfObject to be returned
        Returns:
        A direct PdfObject or null
      • getKeys

        public java.util.Set getKeys()
      • size

        public int size()
      • contains

        public boolean contains​(PdfName key)
      • isDictionaryType

        public boolean isDictionaryType​(PdfName type)
        Deprecated.
        Checks if a PdfDictionary is of a certain type.
        Parameters:
        type - a type of dictionary
        Returns:
        true of false
      • isFont

        public boolean isFont()
        Checks if a Dictionary is of the type FONT.
        Returns:
        true if it is, false if it isn't.
      • isPage

        public boolean isPage()
        Checks if a Dictionary is of the type PAGE.
        Returns:
        true if it is, false if it isn't.
      • isPages

        public boolean isPages()
        Checks if a Dictionary is of the type PAGES.
        Returns:
        true if it is, false if it isn't.
      • isCatalog

        public boolean isCatalog()
        Checks if a Dictionary is of the type CATALOG.
        Returns:
        true if it is, false if it isn't.
      • isOutlineTree

        public boolean isOutlineTree()
        Checks if a Dictionary is of the type OUTLINES.
        Returns:
        true if it is, false if it isn't.
      • mergeDifferent

        public void mergeDifferent​(PdfDictionary other)
      • getAsDict

        public PdfDictionary getAsDict​(PdfName key)
        Returns a PdfObject as a PdfDictionary, resolving indirect references. The object associated with the PdfName given is retrieved and resolved to a direct object. If it is a PdfDictionary, it is cast down and returned as such. Otherwise null is returned.
        Parameters:
        key - A PdfName
        Returns:
        the associated PdfDictionary object, or null
      • getAsArray

        public PdfArray getAsArray​(PdfName key)
        Returns a PdfObject as a PdfArray, resolving indirect references. The object associated with the PdfName given is retrieved and resolved to a direct object. If it is a PdfArray, it is cast down and returned as such. Otherwise null is returned.
        Parameters:
        key - A PdfName
        Returns:
        the associated PdfArray object, or null
      • getAsStream

        public PdfStream getAsStream​(PdfName key)
        Returns a PdfObject as a PdfStream, resolving indirect references. The object associated with the PdfName given is retrieved and resolved to a direct object. If it is a PdfStream, it is cast down and returned as such. Otherwise null is returned.
        Parameters:
        key - A PdfName
        Returns:
        the associated PdfStream object, or null
      • getAsString

        public PdfString getAsString​(PdfName key)
        Returns a PdfObject as a PdfString, resolving indirect references. The object associated with the PdfName given is retrieved and resolved to a direct object. If it is a PdfString, it is cast down and returned as such. Otherwise null is returned.
        Parameters:
        key - A PdfName
        Returns:
        the associated PdfString object, or null
      • getAsNumber

        public PdfNumber getAsNumber​(PdfName key)
        Returns a PdfObject as a PdfNumber, resolving indirect references. The object associated with the PdfName given is retrieved and resolved to a direct object. If it is a PdfNumber, it is cast down and returned as such. Otherwise null is returned.
        Parameters:
        key - A PdfName
        Returns:
        the associated PdfNumber object, or null
      • getAsName

        public PdfName getAsName​(PdfName key)
        Returns a PdfObject as a PdfName, resolving indirect references. The object associated with the PdfName given is retrieved and resolved to a direct object. If it is a PdfName, it is cast down and returned as such. Otherwise null is returned.
        Parameters:
        key - A PdfName
        Returns:
        the associated PdfName object, or null
      • getAsBoolean

        public PdfBoolean getAsBoolean​(PdfName key)
        Returns a PdfObject as a PdfBoolean, resolving indirect references. The object associated with the PdfName given is retrieved and resolved to a direct object. If it is a PdfBoolean, it is cast down and returned as such. Otherwise null is returned.
        Parameters:
        key - A PdfName
        Returns:
        the associated PdfBoolean object, or null
      • getAsIndirectObject

        public PdfIndirectReference getAsIndirectObject​(PdfName key)
        Returns a PdfObject as a PdfIndirectReference. The object associated with the PdfName given is retrieved If it is a PdfIndirectReference, it is cast down and returned as such. Otherwise null is returned.
        Parameters:
        key - A PdfName
        Returns:
        the associated PdfIndirectReference object, or null