Class LinkContext
java.lang.Object
com.itextpdf.html2pdf.attach.impl.LinkContext
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 TypeMethodDescriptionvoid
addLinkAnnotation
(String id, com.itextpdf.kernel.pdf.annot.PdfLinkAnnotation annot) Add link annotation to the context.com.itextpdf.kernel.pdf.annot.PdfLinkAnnotation
Get link annotation.boolean
isUsedLinkDestination
(String linkDestination) Returns whether a given (internal) link destination is used by at least one href element in the documentscanForIds
(com.itextpdf.styledxmlparser.node.INode root) Scan the DOM tree for all (internal) link targets
-
Constructor Details
-
LinkContext
public LinkContext()Construct an (empty) LinkContext
-
-
Method Details
-
scanForIds
Scan the DOM tree for all (internal) link targets- Parameters:
-
root
- the DOM tree root node - Returns:
- this LinkContext
-
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.
-