Class Node
- java.lang.Object
-
- com.pdftools.toolbox.internal.NativeBase
-
- com.pdftools.toolbox.internal.NativeObject
-
- com.pdftools.toolbox.pdf.structure.Node
-
public class Node extends NativeObject
This class represents a structure element node in the structure element tree of a tagged PDF. Nodes may either have a collection of other nodes as children, or be associated with marked content. These two roles cannot be mixed.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAbbreviation()
The expanded form of an abbreviation or an acronymjava.lang.String
getActualText()
Actual text is a textual replacement for the content.java.lang.String
getAlternateText()
Alternate text to be used where the content denoted by the structure element and its children cannot be rendered because of accessibility or other concerns.Rectangle
getBoundingBox()
Bounding box for contents - should only be set for Figure, Formula and Table (Getter)NodeList
getChildren()
The list of child nodes under this node in the structure element tree.java.lang.String
getLanguage()
A language identifier specifying the natural language for all text in the nodePage
getPage()
The page on which marked content associated with the structure element node is to be found.Node
getParent()
The parent node in the structure element tree.java.lang.String
getStringAttribute(java.lang.String key)
Query a string attributejava.lang.String
getTag()
Tags should conform to the Standard Structure Types described within the PDF standard.void
setAbbreviation(java.lang.String value)
The expanded form of an abbreviation or an acronymvoid
setActualText(java.lang.String value)
Actual text is a textual replacement for the content.void
setAlternateText(java.lang.String value)
Alternate text to be used where the content denoted by the structure element and its children cannot be rendered because of accessibility or other concerns.void
setBoundingBox(Rectangle value)
Bounding box for contents - should only be set for Figure, Formula and Table (Setter)void
setLanguage(java.lang.String value)
A language identifier specifying the natural language for all text in the nodevoid
setPage(Page value)
The page on which marked content associated with the structure element node is to be found.void
setStringAttribute(java.lang.String key, java.lang.String value)
Set a string attributevoid
setTag(java.lang.String value)
Tags should conform to the Standard Structure Types described within the PDF standard.-
Methods inherited from class com.pdftools.toolbox.internal.NativeObject
equals, hashCode
-
-
-
-
Constructor Detail
-
Node
public Node(java.lang.String tag, Document document)
- Parameters:
tag
- Tags should conform to the Standard Structure Types described within the PDF standard or refer to entries in the RoleMap. Allowed values from the PDF standard are: Document, Part, Sect, Art, Div, H1, H2, H3, H4, H5, H6, P, L, LI, Lbl, LBody, Table, TR, TH, TD, THead, TBody, TFoot, Span, Quote, Note, Reference, Figure, Caption, Artifact, Form, Field, Link, Code, Annot, Ruby, Warichu, TOC, TOCI, Index and BibEntry.document
- The document containing the structure element tree.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closedjava.lang.IllegalArgumentException
- iftag
isnull
java.lang.IllegalArgumentException
- ifdocument
isnull
-
Node
public Node(java.lang.String tag, Document document, Page page)
- Parameters:
tag
- Tags should conform to the Standard Structure Types described within the PDF standard or refer to entries in the RoleMap. Allowed values from the PDF standard are: Document, Part, Sect, Art, Div, H1, H2, H3, H4, H5, H6, P, L, LI, Lbl, LBody, Table, TR, TH, TD, THead, TBody, TFoot, Span, Quote, Note, Reference, Figure, Caption, Artifact, Form, Field, Link, Code, Annot, Ruby, Warichu, TOC, TOCI, Index and BibEntry.document
- The document containing the structure element tree.page
- The page on which marked content associated with the structure element node is to be found. This is optional, but is best omitted for nodes which are not associated with marked content.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closedjava.lang.IllegalArgumentException
- iftag
isnull
java.lang.IllegalArgumentException
- ifdocument
isnull
-
-
Method Detail
-
getStringAttribute
public java.lang.String getStringAttribute(java.lang.String key)
Query a string attribute
- Parameters:
key
- The attribute key- Returns:
- the attribute value
- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closedjava.lang.IllegalArgumentException
- ifkey
isnull
-
setStringAttribute
public void setStringAttribute(java.lang.String key, java.lang.String value)
Set a string attribute
- Parameters:
key
- The attribute keyvalue
- The attribute value- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closedjava.lang.IllegalArgumentException
- ifkey
isnull
java.lang.IllegalArgumentException
- ifvalue
isnull
-
getParent
public Node getParent()
The parent node in the structure element tree.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closedjava.lang.UnsupportedOperationException
- if the parent is the structure element tree root node
-
getChildren
public NodeList getChildren() throws NotFoundException
The list of child nodes under this node in the structure element tree. Once child nodes have been added to a node, it can no longer be associated with marked content.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closedNotFoundException
- if the node's list of children is invalid
-
getTag
public java.lang.String getTag() throws NotFoundException
Tags should conform to the Standard Structure Types described within the PDF standard.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closedNotFoundException
- if the node tag is invalid
-
setTag
public void setTag(java.lang.String value) throws NotFoundException
Tags should conform to the Standard Structure Types described within the PDF standard.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closedNotFoundException
- if the node tag is invalidjava.lang.IllegalArgumentException
- ifvalue
isnull
-
getPage
public Page getPage()
The page on which marked content associated with the structure element node is to be found. This is optional, but is best omitted for nodes which are not associated with marked content.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closed
-
setPage
public void setPage(Page value)
The page on which marked content associated with the structure element node is to be found. This is optional, but is best omitted for nodes which are not associated with marked content.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closed
-
getAlternateText
public java.lang.String getAlternateText()
Alternate text to be used where the content denoted by the structure element and its children cannot be rendered because of accessibility or other concerns.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closed
-
setAlternateText
public void setAlternateText(java.lang.String value)
Alternate text to be used where the content denoted by the structure element and its children cannot be rendered because of accessibility or other concerns.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closed
-
getActualText
public java.lang.String getActualText()
Actual text is a textual replacement for the content.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closed
-
setActualText
public void setActualText(java.lang.String value)
Actual text is a textual replacement for the content.- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closed
-
getLanguage
public java.lang.String getLanguage()
A language identifier specifying the natural language for all text in the node- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closed
-
setLanguage
public void setLanguage(java.lang.String value)
A language identifier specifying the natural language for all text in the node- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closed
-
getAbbreviation
public java.lang.String getAbbreviation()
The expanded form of an abbreviation or an acronym- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closed
-
setAbbreviation
public void setAbbreviation(java.lang.String value)
The expanded form of an abbreviation or an acronym- Throws:
java.lang.IllegalStateException
- if the object or the owning document has already been closed
-
getBoundingBox
public Rectangle getBoundingBox()
Bounding box for contents - should only be set for Figure, Formula and Table (Getter)
- Throws:
java.lang.IllegalStateException
- if the object has already been closed
-
setBoundingBox
public void setBoundingBox(Rectangle value)
Bounding box for contents - should only be set for Figure, Formula and Table (Setter)
- Throws:
java.lang.IllegalStateException
- if the object has already been closedjava.lang.IllegalArgumentException
- if a valid bounding box is not supplied
-
-