Class PDTargetDirectory

  • All Implemented Interfaces:
    COSObjectable

    public class PDTargetDirectory
    extends java.lang.Object
    implements COSObjectable
    A target dictionary specifying path information to the target document. Each target dictionary specifies one element in the full path to the target and may have nested target dictionaries specifying additional elements.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private COSDictionary dict  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getAnnotationIndex()
      If the value in the /A entry is an integer, this will get the index (zero-based) of the annotation in the /Annots array of the page specified by the /P entry.
      java.lang.String getAnnotationName()
      If the value in the /A entry is a string, this will get the value of the /NM entry in the annotation dictionary.
      COSDictionary getCOSObject()
      This will get the underlying dictionary that this class acts on.
      java.lang.String getFilename()
      Get the name of the file as found in the EmbeddedFiles name tree.
      PDNamedDestination getNamedDestination()
      If the value in the /P entry is a string, this will get a named destination in the current document that provides the page number of the file attachment annotation.
      int getPageNumber()
      If the value in the /P entry is an integer, this will get the page number (zero-based) in the current document containing the file attachment annotation.
      COSName getRelationship()
      Get the relationship between the current document and the target (which may be an intermediate target).
      PDTargetDirectory getTargetDirectory()
      Get the target directory.
      void setAnnotationIndex​(int index)
      This will set the index (zero-based) of the annotation in the /Annots array of the page specified by the /P entry.
      void setAnnotationName​(java.lang.String name)
      This will get the value of the /NM entry in the annotation dictionary.
      void setFilename​(java.lang.String filename)
      Sets the name of the file as found in the EmbeddedFiles name tree.
      void setNamedDestination​(PDNamedDestination dest)
      This will set a named destination in the current document that provides the page number of the file attachment annotation.
      void setPageNumber​(int pageNumber)
      Set the page number (zero-based) in the current document containing the file attachment annotation.
      void setRelationship​(COSName relationship)
      Set the relationship between the current document and the target (which may be an intermediate target).
      void setTargetDirectory​(PDTargetDirectory targetDirectory)
      Sets the target directory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PDTargetDirectory

        public PDTargetDirectory()
        Default constructor, creates target directory.
      • PDTargetDirectory

        public PDTargetDirectory​(COSDictionary dictionary)
        Create a target directory from an existing dictionary.
        Parameters:
        dictionary - The existing graphics state.
    • Method Detail

      • getCOSObject

        public COSDictionary getCOSObject()
        This will get the underlying dictionary that this class acts on.
        Specified by:
        getCOSObject in interface COSObjectable
        Returns:
        The underlying dictionary for this class.
      • getRelationship

        public COSName getRelationship()
        Get the relationship between the current document and the target (which may be an intermediate target).
        Returns:
        the relationship as a name. Valid values are P (the target is the parent of the current document) and C (the target is a child of the current document). Invalid values or null are also returned.
      • setRelationship

        public void setRelationship​(COSName relationship)
        Set the relationship between the current document and the target (which may be an intermediate target).
        Parameters:
        relationship - Valid values are P (the target is the parent of the current document) and C (the target is a child of the current document). throws IllegalArgumentException if the parameter is not P or C.
      • getFilename

        public java.lang.String getFilename()
        Get the name of the file as found in the EmbeddedFiles name tree. This is only to be used if the target is a child of the current document.
        Returns:
        a filename or null if there is none.
      • setFilename

        public void setFilename​(java.lang.String filename)
        Sets the name of the file as found in the EmbeddedFiles name tree. This is only to be used if the target is a child of the current document.
        Parameters:
        filename - a filename or null if the entry is to be deleted.
      • getTargetDirectory

        public PDTargetDirectory getTargetDirectory()
        Get the target directory. If this entry is absent, the current document is the target file containing the destination.
        Returns:
        the target directory or null if the current document is the target file containing the destination.
      • setTargetDirectory

        public void setTargetDirectory​(PDTargetDirectory targetDirectory)
        Sets the target directory.
        Parameters:
        targetDirectory - the target directory or null if the current document is the target file containing the destination.
      • getPageNumber

        public int getPageNumber()
        If the value in the /P entry is an integer, this will get the page number (zero-based) in the current document containing the file attachment annotation.
        Returns:
        the zero based page number or -1 if the /P entry value is missing or not a number.
      • setPageNumber

        public void setPageNumber​(int pageNumber)
        Set the page number (zero-based) in the current document containing the file attachment annotation.
        Parameters:
        pageNumber - the zero based page number. If this is < 0 then the entry is removed.
      • getNamedDestination

        public PDNamedDestination getNamedDestination()
        If the value in the /P entry is a string, this will get a named destination in the current document that provides the page number of the file attachment annotation.
        Returns:
        a named destination or null if the /P entry value is missing or not a string.
      • setNamedDestination

        public void setNamedDestination​(PDNamedDestination dest)
        This will set a named destination in the current document that provides the page number of the file attachment annotation.
        Parameters:
        dest - a named destination or null if the entry is to be removed.
      • getAnnotationIndex

        public int getAnnotationIndex()
        If the value in the /A entry is an integer, this will get the index (zero-based) of the annotation in the /Annots array of the page specified by the /P entry.
        Returns:
        the zero based page number or -1 if the /P entry value is missing or not a number.
      • setAnnotationIndex

        public void setAnnotationIndex​(int index)
        This will set the index (zero-based) of the annotation in the /Annots array of the page specified by the /P entry.
        Parameters:
        index - the zero based index. If this is < 0 then the entry is removed.
      • getAnnotationName

        public java.lang.String getAnnotationName()
        If the value in the /A entry is a string, this will get the value of the /NM entry in the annotation dictionary.
        Returns:
        the /NM value of an annotation dictionary or null if the /A entry value is missing or not a string.
      • setAnnotationName

        public void setAnnotationName​(java.lang.String name)
        This will get the value of the /NM entry in the annotation dictionary.
        Parameters:
        name - the /NM value of an annotation dictionary or null if the entry is to be removed.