Class LinkRenderer

All Implemented Interfaces:
IPropertyContainer, ILeafElementRenderer, IRenderer

public class LinkRenderer extends TextRenderer
  • Constructor Details

    • LinkRenderer

      public LinkRenderer (Link link)
      Creates a LinkRenderer from its corresponding layout object.
      Parameters:
      link - the Link which this object should manage
    • LinkRenderer

      public LinkRenderer (Link linkElement, String text)
      Creates a LinkRenderer from its corresponding layout object, with a custom text to replace the contents of the Link.
      Parameters:
      linkElement - the Link which this object should manage
      text - the replacement text
  • Method Details

    • draw

      public void draw (DrawContext drawContext)
      Description copied from class: AbstractRenderer
      Flushes the renderer subtree contents, i.e. draws itself on canvas, adds necessary objects to the PdfDocument etc.
      Specified by:
      draw in interface IRenderer
      Overrides:
      draw in class TextRenderer
      Parameters:
      drawContext - contains the PdfDocument to which the renderer subtree if flushed, the PdfCanvas on which the renderer subtree is drawn and other additional parameters needed to perform drawing
    • getNextRenderer

      public IRenderer getNextRenderer()
      Gets a new instance of this class to be used as a next renderer, after this renderer is used, if TextRenderer.layout(LayoutContext) is called more than once.

      If a renderer overflows to the next area, iText uses this method to create a renderer for the overflow part. So if one wants to extend LinkRenderer, one should override this method: otherwise the default method will be used and thus the default rather than the custom renderer will be created.

      Specified by:
      getNextRenderer in interface IRenderer
      Overrides:
      getNextRenderer in class TextRenderer
      Returns:
      new renderer instance