Package com.itextpdf.kernel.pdf.tagutils
Class TagTreeIterator
java.lang.Object
com.itextpdf.kernel.pdf.tagutils.TagTreeIterator
This class is used to traverse the tag tree.
There is a possibility to add a handler that will be called for the elements during the traversal.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Tree traversal order enum. -
Constructor Summary
ConstructorDescriptionTagTreeIterator
(IStructureNode tagTreePointer) Creates a new instance ofTagTreeIterator
.TagTreeIterator
(IStructureNode tagTreePointer, TagTreeIteratorElementApprover approver, TagTreeIterator.TreeTraversalOrder traversalOrder) Creates a new instance ofTagTreeIterator
. -
Method Summary
Modifier and TypeMethodDescriptionaddHandler
(ITagTreeIteratorHandler handler) Adds a handler that will be called for the elements during the traversal.void
traverse()
Traverses the tag tree in the order of the document structure.
-
Constructor Details
-
TagTreeIterator
Creates a new instance ofTagTreeIterator
. It will useTagTreeIteratorElementApprover
to filter elements and TreeTraversalOrder.PRE_ORDER for tree traversal.- Parameters:
-
tagTreePointer
- the tag tree pointer.
-
TagTreeIterator
public TagTreeIterator(IStructureNode tagTreePointer, TagTreeIteratorElementApprover approver, TagTreeIterator.TreeTraversalOrder traversalOrder) Creates a new instance ofTagTreeIterator
.- Parameters:
-
tagTreePointer
- the tag tree pointer. -
approver
- a filter that will be called to let iterator know whether some particular element should be traversed or not. -
traversalOrder
- an order in which the tree will be traversed.
-
-
Method Details
-
addHandler
Adds a handler that will be called for the elements during the traversal.- Parameters:
-
handler
- the handler. - Returns:
-
this
TagTreeIterator
instance.
-
traverse
public void traverse()Traverses the tag tree in the order of the document structure.Make sure the correct handlers are added before calling this method.
-