Class LinkContext
java.lang.Object
com.itextpdf.html2pdf.attach.impl.LinkContext
- All Implemented Interfaces:
-
IDocumentTreeJob
This class keeps track of information regarding link (destinations) that occur in the document. Doing so enables us to drastically trim the amount of PdfDestinations that will end up being included in the document. For performance reasons it was decided to scan the DOM tree only once and store the result in a separate object (this object) in the ProcessorContext.
This class is not reusable and a new instance shall be created for every new conversion process.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLinkAnnotation(String id, com.itextpdf.kernel.pdf.annot.PdfLinkAnnotation annot) Add link annotation to the context.com.itextpdf.kernel.pdf.annot.PdfLinkAnnotationGet link annotation.booleanisUsedLinkDestination(String linkDestination) Returns whether a given (internal) link destination is used by at least one href element in the documentvoidprocess(com.itextpdf.styledxmlparser.node.INode node, int level) Check if an element is a link.scanForIds(com.itextpdf.styledxmlparser.node.INode root) Deprecated.
-
Constructor Details
-
LinkContext
public LinkContext()Construct an (empty) LinkContext
-
-
Method Details
-
scanForIds
Deprecated.Scan the DOM tree for all (internal) link targets Deprecated in favor ofprocess(INode, int)- Parameters:
-
root- the DOM tree root node - Returns:
- this LinkContext
-
process
public void process(com.itextpdf.styledxmlparser.node.INode node, int level) Check if an element is a link.- Specified by:
-
processin interfaceIDocumentTreeJob - Parameters:
-
node- the node to process -
level- the hierarchical level of the node in the document tree structure
-
isUsedLinkDestination
Returns whether a given (internal) link destination is used by at least one href element in the document- Parameters:
-
linkDestination- link destination - Returns:
- whether a given (internal) link destination is used by at least one href element in the document
-
addLinkAnnotation
Add link annotation to the context.- Parameters:
-
id- link destination. -
annot- link annotation to store.
-
getLinkAnnotation
Get link annotation.- Parameters:
-
id- link destination. - Returns:
- link annotation for the given link destination.
-