Class PDTargetDirectory
java.lang.Object
org.apache.pdfbox.pdmodel.interactive.action.PDTargetDirectory
- All Implemented Interfaces:
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.
- Author:
- Tilman Hausherr
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor, creates target directory.PDTargetDirectory
(COSDictionary dictionary) Create a target directory from an existing dictionary. -
Method Summary
Modifier and TypeMethodDescriptionint
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.If the value in the /A entry is a string, this will get the value of the /NM entry in the annotation dictionary.This will get the underlying dictionary that this class acts on.Get the name of the file as found in the EmbeddedFiles name tree.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
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.Get the relationship between the current document and the target (which may be an intermediate target).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
(String name) This will get the value of the /NM entry in the annotation dictionary.void
setFilename
(String filename) Sets the name of the file as found in the EmbeddedFiles name tree.void
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.
-
Constructor Details
-
PDTargetDirectory
public PDTargetDirectory()Default constructor, creates target directory. -
PDTargetDirectory
Create a target directory from an existing dictionary.- Parameters:
dictionary
- The existing graphics state.
-
-
Method Details
-
getCOSObject
This will get the underlying dictionary that this class acts on.- Specified by:
getCOSObject
in interfaceCOSObjectable
- Returns:
- The underlying dictionary for this class.
-
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
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
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
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
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
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
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.
-
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
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
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.
-