Class PdfStructElement
public sealed class PdfStructElement : PdfTaggedObject, IDisposable
- Inheritance
-
PdfStructElement
- Implements
- Inherited Members
Methods
CountChildren()
Gets the number of child structure elements (or content references) under this element.
public int CountChildren()
Returns
GetActualText()
Retrieves the ActualText associated with this structure element, if present.
public string GetActualText()
Returns
- string
The actual text as a string, or an empty string if not defined.
GetAltText()
Gets the alternative text (/Alt) associated with this structure element, if present.
public string GetAltText()
Returns
- string
The alternative text string, or an empty string if none exists.
GetAttributeAt(int)
Gets the attribute value at the specified index in the element's /A dictionary.
public PdfStructAttributeValue? GetAttributeAt(int index)
Parameters
index
intZero-based index into the attribute set.
Returns
- PdfStructAttributeValue
A PdfStructAttributeValue, or null if invalid or missing.
GetAttributeCount()
Returns the number of attributes directly associated with this structure element.
public int GetAttributeCount()
Returns
GetAttributes()
Gets the full attribute dictionary for this structure element.
public PdfStructAttributeSet? GetAttributes()
Returns
- PdfStructAttributeSet
A PdfStructAttributeSet representing the attributes, or null if none exist.
GetChildAt(int)
Gets the child structure element at the given index.
public PdfStructElement GetChildAt(int index)
Parameters
index
intIndex of the child.
Returns
- PdfStructElement
The child PdfStructElement.
Exceptions
- ArgumentOutOfRangeException
If index is invalid.
GetChildMarkedContentID(int)
Gets the Marked Content ID (MCID) for the child at the specified index.
public int GetChildMarkedContentID(int index)
Parameters
index
intIndex of the structure child.
Returns
- int
The MCID if present, or -1 if the child is not marked content.
GetElementType()
Gets the structure element type as an enum.
public PdfStructElementType GetElementType()
Returns
GetId()
Gets the value of the /ID entry for this structure element.
public string GetId()
Returns
- string
The ID string, or an empty string if not present.
GetLanguage()
Gets the language specified for this structure element (e.g., "en-US").
public string GetLanguage()
Returns
- string
The language string, or an empty string if not defined.
GetMarkedContentId()
Gets the primary Marked Content ID (MCID) associated with this structure element.
public int GetMarkedContentId()
Returns
- int
The MCID, or -1 if not associated with any marked content.
GetMarkedContentIdAt(int)
Gets the Marked Content ID (MCID) at the specified index, if the child at that index is a marked content item.
public int GetMarkedContentIdAt(int index)
Parameters
index
intIndex of the child within this structure element.
Returns
- int
The MCID, or -1 if the entry is not marked content.
GetMarkedContentIdCount()
Gets the number of Marked Content IDs associated with this structure element.
public int GetMarkedContentIdCount()
Returns
- int
The count of MCIDs (can be 0).
GetObjectType()
Gets the /ObjType string associated with this structure element (if present).
public string GetObjectType()
Returns
- string
The object type string (e.g., "Annot", "Layout"), or an empty string if none is defined.
GetParent()
Gets the parent structure element of this node, if one exists.
public PdfStructElement? GetParent()
Returns
- PdfStructElement
A PdfStructElement representing the parent, or
null
if this is the root element.
GetRawType()
Gets the structure type of this element (e.g., "H1", "P", "Table").
public string GetRawType()
Returns
GetStringAttribute(string)
Retrieves the value of a string attribute associated with the specified key from the structure element.
public string GetStringAttribute(string key)
Parameters
key
stringThe key of the attribute to retrieve. This value cannot be null.
Returns
- string
The value of the string attribute if it exists; otherwise, an empty string.
Exceptions
- dotPDFiumException
Thrown if the attribute retrieval fails or the written size exceeds the buffer size.
GetTitle()
Gets the /T (title) entry of this structure element, if present.
public string GetTitle()
Returns
- string
The title string, or an empty string if not defined.