Package net.sf.jasperreports.pdf.classic
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, PAGESFields 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 TypeMethodDescriptionvoidaddAnnotationParent(com.lowagie.text.pdf.PdfAnnotation annotation, com.lowagie.text.pdf.PdfIndirectReference structElemReference) Registers an annotation for /StructParent assignment.protected voidstatic ClassicPdfStructureTreeRootinstall(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, mapRoleMethods 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, toStringMethods inherited from class com.lowagie.text.pdf.PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
-
Method Details
-
install
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 inbuildTree()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
- Overrides:
buildTreein classcom.lowagie.text.pdf.PdfStructureTreeRoot- Throws:
IOException
-