Class PdfOutline

java.lang.Object
com.itextpdf.kernel.pdf.PdfOutline

public class PdfOutline extends Object
Document outline object See ISO-320001, 12.3.3 Document Outline.
  • Field Details

    • FLAG_ITALIC

      public static int FLAG_ITALIC
      A flag for displaying the outline item’s text with italic font.
    • FLAG_BOLD

      public static int FLAG_BOLD
      A flag for displaying the outline item’s text with bold font.
  • Method Details

    • getTitle

      public String getTitle()
      Gets title of the outline.
      Returns:
      String value.
    • setTitle

      public void setTitle (String title)
      Sets title of the outline with PdfEncodings.UNICODE_BIG encoding, Title key.
      Parameters:
      title - String value.
    • setColor

      public void setColor (Color color)
      Sets color for the outline entry’s text, C key.
      Parameters:
      color - Color
    • getColor

      public Color getColor()
      Gets color for the outline entry's text, C key.
      Returns:
      color Color.
    • setStyle

      public void setStyle (int style)
      Sets text style for the outline entry’s text, F key.
      Parameters:
      style - Could be either FLAG_BOLD or FLAG_ITALIC. Default value is 0.
    • getStyle

      public Integer getStyle()
      Gets text style for the outline entry's text, F key.
      Returns:
      style value.
    • getContent

      public PdfDictionary getContent()
      Gets content dictionary.
      Returns:
      PdfDictionary.
    • getAllChildren

      public List<PdfOutline> getAllChildren()
      Gets list of children outlines.
      Returns:
      List of PdfOutline.
    • getParent

      public PdfOutline getParent()
      Gets parent outline.
      Returns:
      PdfOutline.
    • getDestination

      public PdfDestination getDestination()
      Returns:
      PdfDestination.
    • addDestination

      public void addDestination (PdfDestination destination)
      Adds PdfDestination for the outline, Dest key.
      Parameters:
      destination - instance of PdfDestination.
    • addAction

      public void addAction (PdfAction action)
      Adds PdfAction for the outline, A key.
      Parameters:
      action - instance of PdfAction.
    • setOpen

      public void setOpen (boolean open)
      Defines if the outline needs to be closed or not. By default, outlines are open.
      Parameters:
      open - if false, the outline will be closed by default
    • isOpen

      public boolean isOpen()
      Defines if the outline is open or closed.
      Returns:
      true if open,false otherwise.
    • addOutline

      public PdfOutline addOutline (String title, int position)
      Adds a new PdfOutline with specified parameters as a child to existing PdfOutline and put it to specified position in the existing PdfOutline children list.
      Parameters:
      title - an outline title
      position - a position in the current outline child List where a new outline should be added. If the position equals -1, then the outline will be put in the end of children list.
      Returns:
      just created outline
    • addOutline

      public PdfOutline addOutline (String title)
      Adds an PdfOutline as a child to existing PdfOutline and put it in the end of the existing PdfOutline children list.
      Parameters:
      title - an outline title
      Returns:
      just created outline
    • addOutline

      public PdfOutline addOutline (PdfOutline outline)
      Adds an PdfOutline as a child to existing PdfOutline and put it to the end of the existing PdfOutline children list.
      Parameters:
      outline - an outline to add.
      Returns:
      just created outline
    • removeOutline

      public void removeOutline()
      Remove this outline from the document. Outlines that are children of this outline are removed recursively