Table of Contents

Class PdfStructElem

Namespace
iText.Kernel.Pdf.Tagging
Assembly
itext.kernel.dll

A wrapper for structure element dictionaries (ISO-32000 14.7.2 "Structure Hierarchy").

public class PdfStructElem : PdfObjectWrapper<PdfDictionary>, IStructureNode
Inheritance
PdfStructElem
Implements
Inherited Members

Remarks

A wrapper for structure element dictionaries (ISO-32000 14.7.2 "Structure Hierarchy").

The logical structure of a document shall be described by a hierarchy of objects called the structure hierarchy or structure tree. At the root of the hierarchy shall be a dictionary object called the structure tree root (see PdfStructTreeRoot ). Immediate children of the structure tree root are structure elements. Structure elements are other structure elements or content items.

Constructors

PdfStructElem(PdfDictionary)

public PdfStructElem(PdfDictionary pdfObject)

Parameters

pdfObject PdfDictionary

PdfStructElem(PdfDocument, PdfName)

public PdfStructElem(PdfDocument document, PdfName role)

Parameters

document PdfDocument
role PdfName

PdfStructElem(PdfDocument, PdfName, PdfAnnotation)

public PdfStructElem(PdfDocument document, PdfName role, PdfAnnotation annot)

Parameters

document PdfDocument
role PdfName
annot PdfAnnotation

PdfStructElem(PdfDocument, PdfName, PdfPage)

public PdfStructElem(PdfDocument document, PdfName role, PdfPage page)

Parameters

document PdfDocument
role PdfName
page PdfPage

Methods

AddAssociatedFile(string, PdfFileSpec)

Adds file associated with structure element and identifies the relationship between them.

public virtual void AddAssociatedFile(string description, PdfFileSpec fs)

Parameters

description string

the file description

fs PdfFileSpec

file specification dictionary of associated file

Remarks

Adds file associated with structure element and identifies the relationship between them.

Associated files may be used in Pdf/A-3 and Pdf 2.0 documents. The method adds file to array value of the AF key in the structure element dictionary. If description is provided, it also will add file description to catalog Names tree.

For associated files their associated file specification dictionaries shall include the AFRelationship key

AddAssociatedFile(PdfFileSpec)

Adds file associated with structure element and identifies the relationship between them.
public virtual void AddAssociatedFile(PdfFileSpec fs)

Parameters

fs PdfFileSpec

file specification dictionary of associated file

Remarks

Adds file associated with structure element and identifies the relationship between them.

Associated files may be used in Pdf/A-3 and Pdf 2.0 documents. The method adds file to array value of the AF key in the structure element dictionary.

For associated files their associated file specification dictionaries shall include the AFRelationship key

AddKid(int, PdfMcr)

public virtual PdfMcr AddKid(int index, PdfMcr kid)

Parameters

index int
kid PdfMcr

Returns

PdfMcr

AddKid(int, PdfStructElem)

public virtual PdfStructElem AddKid(int index, PdfStructElem kid)

Parameters

index int
kid PdfStructElem

Returns

PdfStructElem

AddKid(PdfMcr)

public virtual PdfMcr AddKid(PdfMcr kid)

Parameters

kid PdfMcr

Returns

PdfMcr

AddKid(PdfStructElem)

public virtual PdfStructElem AddKid(PdfStructElem kid)

Parameters

kid PdfStructElem

Returns

PdfStructElem

AddRef(PdfStructElem)

A Ref identifies the structure element to which the item of content, contained within this structure element, refers (e.g. footnotes, endnotes, sidebars, etc.).

public virtual void AddRef(PdfStructElem @ref)

Parameters

ref PdfStructElem

a PdfStructElem to which the item of content, contained within this structure element, refers.

Remarks

A Ref identifies the structure element to which the item of content, contained within this structure element, refers (e.g. footnotes, endnotes, sidebars, etc.).

This value has meaning only for the PDF documents of version 2.0 and higher.

Flush()

public override void Flush()

GetActualText()

public virtual PdfString GetActualText()

Returns

PdfString

GetAlt()

public virtual PdfString GetAlt()

Returns

PdfString

GetAssociatedFiles(bool)

Returns files associated with structure element.

public virtual PdfArray GetAssociatedFiles(bool create)

Parameters

create bool

defines whether AF arrays will be created if it doesn't exist

Returns

PdfArray

associated files array

GetAttributes(bool)

Gets attributes object.

public virtual PdfObject GetAttributes(bool createNewIfNull)

Parameters

createNewIfNull bool

sometimes attributes object may not exist. Pass true if you want to create empty dictionary in such case. The attributes dictionary will be stored inside element.

Returns

PdfObject

attributes dictionary.

GetDocument()

protected virtual PdfDocument GetDocument()

Returns

PdfDocument

GetE()

public virtual PdfString GetE()

Returns

PdfString

GetK()

public virtual PdfObject GetK()

Returns

PdfObject

GetKids()

Gets list of the direct kids of structure element.

public virtual IList<IStructureNode> GetKids()

Returns

IList<IStructureNode>

list of the direct kids of structure element.

Remarks

Gets list of the direct kids of structure element. If certain kid is flushed, there will be a null in the list on it's place.

GetLang()

public virtual PdfString GetLang()

Returns

PdfString

GetNamespace()

A namespace this element belongs to (see ISO 32000-2 14.7.4, "Namespaces").

public virtual PdfNamespace GetNamespace()

Returns

PdfNamespace

a PdfNamespace this element belongs to.

Remarks

A namespace this element belongs to (see ISO 32000-2 14.7.4, "Namespaces"). If not present, the element shall be considered to be in the default standard structure namespace.

GetParent()

public virtual IStructureNode GetParent()

Returns

IStructureNode

parent of the current structure element. Returns null if parent isn't set or if either current element or parent are invalid.

GetPhoneme()

Attribute for a structure element that may be used as pronunciation hint.

public virtual PdfString GetPhoneme()

Returns

PdfString

a PdfString which defines an exact replacement for content enclosed by the structure element and its children. This value is to be interpreted based on the PhoneticAlphabet attribute in effect.

Remarks

Attribute for a structure element that may be used as pronunciation hint. It is an exact replacement for content enclosed by the structure element and its children.

GetPhoneticAlphabet()

Attribute for a structure element that indicates the phonetic alphabet used by a Phoneme attribute.

public virtual PdfName GetPhoneticAlphabet()

Returns

PdfName

the PdfName which defines phonetic alphabet used by a Phoneme , or null if not defined, default value ipa . See SetPhoneticAlphabet(PdfName) for other possible values.

Remarks

Attribute for a structure element that indicates the phonetic alphabet used by a Phoneme attribute. Applies to the structure element and its children, except where overridden by a child structure element.

GetRefsList()

A Ref identifies the structure element or elements to which the item of content, contained within this structure element, refers (e.g. footnotes, endnotes, sidebars, etc.).

public virtual IList<PdfStructElem> GetRefsList()

Returns

IList<PdfStructElem>

a < PdfStructElem

containing zero, one or more structure elements.

GetRole()

public virtual PdfName GetRole()

Returns

PdfName

GetStructureElementId()

Gets the structure element's ID string, if it has one.

public virtual PdfString GetStructureElementId()

Returns

PdfString

the structure element's ID string, or null if there is none

IsStructElem(PdfDictionary)

Method to distinguish struct elements from other elements of the logical tree (like mcr or struct tree root).

public static bool IsStructElem(PdfDictionary dictionary)

Parameters

dictionary PdfDictionary

the PdfDictionary to check on containing struct elements

Returns

bool

if the type of PdfDictionary is StructElem or PdfDictionary contains the required key S then true, otherwise false

IsWrappedObjectMustBeIndirect()

protected override bool IsWrappedObjectMustBeIndirect()

Returns

bool

Put(PdfName, PdfObject)

public virtual PdfStructElem Put(PdfName key, PdfObject value)

Parameters

key PdfName
value PdfObject

Returns

PdfStructElem

RemoveKid(int)

public virtual IStructureNode RemoveKid(int index)

Parameters

index int

Returns

IStructureNode

RemoveKid(int, bool)

public virtual IStructureNode RemoveKid(int index, bool prepareForReAdding)

Parameters

index int
prepareForReAdding bool

Returns

IStructureNode

RemoveKid(IStructureNode)

public virtual int RemoveKid(IStructureNode kid)

Parameters

kid IStructureNode

Returns

int

SetActualText(PdfString)

public virtual void SetActualText(PdfString actualText)

Parameters

actualText PdfString

SetAlt(PdfString)

public virtual void SetAlt(PdfString alt)

Parameters

alt PdfString

SetAttributes(PdfObject)

public virtual void SetAttributes(PdfObject attributes)

Parameters

attributes PdfObject

SetE(PdfString)

public virtual void SetE(PdfString e)

Parameters

e PdfString

SetLang(PdfString)

public virtual void SetLang(PdfString lang)

Parameters

lang PdfString

SetNamespace(PdfNamespace)

A namespace this element belongs to (see ISO 32000-2 14.7.4, "Namespaces").

public virtual void SetNamespace(PdfNamespace @namespace)

Parameters

namespace PdfNamespace

a PdfNamespace this element belongs to, or null if element is desired to be considered in the default standard structure namespace.

Remarks

A namespace this element belongs to (see ISO 32000-2 14.7.4, "Namespaces").

This value has meaning only for the PDF documents of version 2.0 and higher.

SetPhoneme(PdfString)

Attribute for a structure element that may be used as pronunciation hint.

public virtual void SetPhoneme(PdfString elementPhoneme)

Parameters

elementPhoneme PdfString

a PdfString which defines an exact replacement for content enclosed by the structure element and its children. This value is to be interpreted based on the PhoneticAlphabet attribute in effect.

Remarks

Attribute for a structure element that may be used as pronunciation hint. It is an exact replacement for content enclosed by the structure element and its children.

This value has meaning only for the PDF documents of version 2.0 and higher.

SetPhoneticAlphabet(PdfName)

Attribute for a structure element that indicates the phonetic alphabet used by a Phoneme attribute.

public virtual void SetPhoneticAlphabet(PdfName phoneticAlphabet)

Parameters

phoneticAlphabet PdfName

the PdfName which defines phonetic alphabet used by a Phoneme attribute. Possible values are:

  • ipa for the International Phonetic Alphabet by the International Phonetic Association;
  • x_sampa for Extended Speech Assessment Methods Phonetic Alphabet (X-SAMPA);
  • zh_Latn_pinyin for Pinyin Latin romanization (Mandarin);
  • zh_Latn_wadegile for Wade-Giles romanization (Mandarin).
Other values may be used.

Remarks

Attribute for a structure element that indicates the phonetic alphabet used by a Phoneme attribute. Applies to the structure element and its children, except where overridden by a child structure element.

This value has meaning only for the PDF documents of version 2.0 and higher.

SetRole(PdfName)

public virtual void SetRole(PdfName role)

Parameters

role PdfName

SetStructureElementId(PdfString)

Sets the structure element's ID string.

public virtual void SetStructureElementId(PdfString id)

Parameters

id PdfString

the element's ID string to be set

Remarks

Sets the structure element's ID string. This value can be used by other structure elements to reference this one.