org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure

## Class PDStructureTreeRoot

- java.lang.Object
- - org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureNode
  - - org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureTreeRoot

All Implemented Interfaces:
  COSObjectable

    public class PDStructureTreeRoot
    extends PDStructureNode

A root of a structure tree.

Author:
  Ben Litchfield, Johannes Koch

### Constructor Summary

Constructors
Constructor and Description
`PDStructureTreeRoot()` Default Constructor.
`PDStructureTreeRoot(COSDictionary dic)` Constructor for an existing structure element.

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`Map<String,Object>` `getClassMap()` Sets the ClassMap.
`PDNameTreeNode<PDStructureElement>` `getIDTree()` Returns the ID tree.
`COSBase` `getK()` Returns the K entry.
`COSArray` `getKArray()` Deprecated. use `getK()` only. /K can be a dictionary or an array, and the next level can also be a dictionary. See file 054080.pdf in PDFBOX-4417 and read "Entries in the structure tree root" in the PDF specification.
`PDNumberTreeNode` `getParentTree()` Returns the parent tree.
`int` `getParentTreeNextKey()` Returns The next key for the parent tree.
`Map<String,Object>` `getRoleMap()` Returns the role map.
`void` `setClassMap(Map<String,Object> classMap)` Sets the ClassMap.
`void` `setIDTree(PDNameTreeNode<PDStructureElement> idTree)` Sets the ID tree.
`void` `setK(COSBase k)` Sets the K entry.
`void` `setParentTree(PDNumberTreeNode parentTree)` Sets the parent tree.
`void` `setParentTreeNextKey(int parentTreeNextkey)` Sets the next key in the parent tree.
`void` `setRoleMap(Map<String,String> roleMap)` Sets the role map.

### Methods inherited from class org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureNode

`appendKid, appendKid, appendObjectableKid, create, createObject, getCOSObject, getKids, getType, insertBefore, insertBefore, insertObjectableBefore, removeKid, removeKid, removeObjectableKid, setKids`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PDStructureTreeRoot

    public PDStructureTreeRoot()

Default Constructor.

#### PDStructureTreeRoot

    public PDStructureTreeRoot(COSDictionary dic)

Constructor for an existing structure element.

Parameters:
  `dic` - The existing dictionary.

### Method Detail

#### getKArray

    @Deprecated
    public COSArray getKArray()

Deprecated. use `getK()` only. /K can be a dictionary or an array, and the next level can also be a dictionary. See file 054080.pdf in PDFBOX-4417 and read "Entries in the structure tree root" in the PDF specification.
Returns the K array entry.

Returns:
  the K array entry

#### getK

    public COSBase getK()

Returns the K entry. This can be a dictionary representing a structure element, or an array of them. To get it as a list of PDStructureElement objects, use `PDStructureNode.getKids()` instead.

Returns:
  the K entry.

#### setK

    public void setK(COSBase k)

Sets the K entry.

Parameters:
  `k` - the K value

#### getIDTree

    public PDNameTreeNode<PDStructureElement> getIDTree()

Returns the ID tree.

Returns:
  the ID tree

#### setIDTree

    public void setIDTree(PDNameTreeNode<PDStructureElement> idTree)

Sets the ID tree.

Parameters:
  `idTree` - the ID tree

#### getParentTree

    public PDNumberTreeNode getParentTree()

Returns the parent tree.

The keys correspond to a single page of the document or to an individual object, e.g. an annotation or an XObject, which have a /StructParent or /StructParents entry.

The values of type `PDParentTreeValue` are either a dictionary or an array. It's a dictionary for individual objects like an annotation or an XObject, and an array for a page object or a content stream containing marked-content sequences identified by an MCID.

Returns:
  the parent tree.

#### setParentTree

    public void setParentTree(PDNumberTreeNode parentTree)

Sets the parent tree.

The keys correspond to a single page of the document or to an individual object, e.g. an annotation or an XObject, which have a /StructParent or /StructParents entry.

The values of type `PDParentTreeValue` are either a dictionary or an array. It's a dictionary for individual objects like an annotation or an XObject, and an array for a page object or a content stream containing marked-content sequences identified by an MCID.

To create an empty parent tree, call `new PDNumberTreeNode(PDParentTreeValue.class)`.

Parameters:
  `parentTree` - the parent tree

#### getParentTreeNextKey

    public int getParentTreeNextKey()

Returns The next key for the parent tree. This is a number greater than any existing key, and which shall be used for the next entry to be added to the tree.

Returns:
  The next key for the parent tree

#### setParentTreeNextKey

    public void setParentTreeNextKey(int parentTreeNextkey)

Sets the next key in the parent tree. This is a number greater than any existing key, and which shall be used for the next entry to be added to the tree.

Parameters:
  `parentTreeNextkey` - The next key in the parent tree.

#### getRoleMap

    public Map<String,Object> getRoleMap()

Returns the role map.

Returns:
  the role map

#### setRoleMap

    public void setRoleMap(Map<String,String> roleMap)

Sets the role map.

Parameters:
  `roleMap` - the role map

#### getClassMap

    public Map<String,Object> getClassMap()

Sets the ClassMap.

Returns:
  the ClassMap, never null. The elements are either `PDAttributeObject` or lists of it.

#### setClassMap

    public void setClassMap(Map<String,Object> classMap)

Sets the ClassMap.

Parameters:
  `classMap` - null, or a map whose elements are either `PDAttributeObject` or lists of it.