Class LinkContext

java.lang.Object
com.itextpdf.html2pdf.attach.impl.LinkContext

public class LinkContext extends Object
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 Details

    • LinkContext

      public LinkContext()
      Construct an (empty) LinkContext
  • Method Details

    • scanForIds

      public LinkContext scanForIds (com.itextpdf.styledxmlparser.node.INode root)
      Scan the DOM tree for all (internal) link targets
      Parameters:
      root - the DOM tree root node
      Returns:
      this LinkContext
    • isUsedLinkDestination

      public boolean isUsedLinkDestination (String linkDestination)
      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