PdfStructureTree Class

The structure tree of a tagged document (ISO 32000-2, 14.7 and 14.8): the logical structure of its content, which assistive technologies read, and the parent tree that maps the marked content of the pages back to its elements.

public sealed class PdfStructureTree

Remarks

The tree is created in the document when the first element is added. Each page whose content is tagged gets a /StructParents key, each tagged annotation a /StructParent key; the parent tree, the /MarkInfo entry of the catalog and the tab order of the pages are written when the document is saved, when the tree was changed through this class: a tree that is only read is saved as it is.

Properties

NameDescription
ElementsGets the elements at the top of the tree. PDF/UA expects one Document element that holds the others.
ExistsGets a value indicating whether the document has a structure tree.
RoleMapGets the role map (/RoleMap, 14.7.3): the custom structure types of the document mapped to the types they are, such as Heading1 to H1.

Gets the elements at the top of the tree. PDF/UA expects one Document element that holds the others.

public IReadOnlyList<PdfStructureElement> Elements { get; }

Gets a value indicating whether the document has a structure tree.

public bool Exists { get; }

Property value

bool

Gets the role map (/RoleMap, 14.7.3): the custom structure types of the document mapped to the types they are, such as Heading1 to H1.

public IReadOnlyDictionary<string, string> RoleMap { get; }

Methods

NameDescription
AddElement(string)Adds an element at the top of the tree.
MapRole(string, string)Maps a custom structure type to the type it is, in the role map.

AddElement(string)

PdfStructureTree.cs

Adds an element at the top of the tree.

public PdfStructureElement AddElement(string type)

Parameters

type string
The structure type, such as Document.

Returns

PdfStructureElement The element.

MapRole(string, string)

PdfStructureTree.cs

Maps a custom structure type to the type it is, in the role map.

public void MapRole(string type, string mappedType)

Parameters

type string
The custom type, such as Heading1.
mappedType string
The type it is: a standard type such as H1, or another custom type.