Class ClassicPdfStructureTreeRoot

java.lang.Object
com.lowagie.text.pdf.PdfObject
com.lowagie.text.pdf.PdfDictionary
com.lowagie.text.pdf.PdfStructureTreeRoot
net.sf.jasperreports.pdf.classic.ClassicPdfStructureTreeRoot

public class ClassicPdfStructureTreeRoot extends com.lowagie.text.pdf.PdfStructureTreeRoot
Extension of PdfStructureTreeRoot that supports annotation /StructParent entries in the ParentTree. For annotations with /StructParent (singular), the ParentTree value must be a direct reference to the StructElem, not an array (which is used for page /StructParents entries). This subclass overrides buildTree() to handle both types of entries correctly. Annotation /StructParent keys are assigned at build time to avoid collisions with page /StructParents values (which are assigned by OpenPDF using page indices 0, 1, 2, ...).
  • Field Summary

    Fields inherited from class com.lowagie.text.pdf.PdfDictionary

    CATALOG, FONT, hashMap, OUTLINES, PAGE, PAGES

    Fields inherited from class com.lowagie.text.pdf.PdfObject

    ARRAY, BOOLEAN, bytes, DICTIONARY, INDIRECT, indRef, NAME, NOTHING, NULL, NUMBER, STREAM, STRING, TEXT_PDFDOCENCODING, TEXT_UNICODE, type
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAnnotationParent(com.lowagie.text.pdf.PdfAnnotation annotation, com.lowagie.text.pdf.PdfIndirectReference structElemReference)
    Registers an annotation for /StructParent assignment.
    protected void
     
    install(com.lowagie.text.pdf.PdfWriter writer)
    Installs this extended tree root into the given PdfWriter, replacing the default PdfStructureTreeRoot.

    Methods inherited from class com.lowagie.text.pdf.PdfStructureTreeRoot

    getReference, getWriter, mapRole

    Methods inherited from class com.lowagie.text.pdf.PdfDictionary

    clear, contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, getKeysAndValues, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toPdf, toString

    Methods inherited from class com.lowagie.text.pdf.PdfObject

    canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • install

      public static ClassicPdfStructureTreeRoot install(com.lowagie.text.pdf.PdfWriter writer)
      Installs this extended tree root into the given PdfWriter, replacing the default PdfStructureTreeRoot. Must be called before any structure elements are created.
      Parameters:
      writer - the PdfWriter to install into
      Returns:
      the installed PdfStructureTreeRootUtil instance
    • addAnnotationParent

      public void addAnnotationParent(com.lowagie.text.pdf.PdfAnnotation annotation, com.lowagie.text.pdf.PdfIndirectReference structElemReference)
      Registers an annotation for /StructParent assignment. The actual ParentTree key is assigned later in buildTree() to avoid collisions with page /StructParents values.
      Parameters:
      annotation - the annotation dictionary (its /StructParent will be set at build time)
      structElemReference - the indirect reference to the StructElem
    • buildTree

      protected void buildTree() throws IOException
      Overrides:
      buildTree in class com.lowagie.text.pdf.PdfStructureTreeRoot
      Throws:
      IOException