# Class: SElement

## PDFNet. SElement

#### new SElement()

  SElement represents PDF structural elements, which are nodes in a tree
  structure, defining a PDF document's logical structure.

  Unlike the StructTree, SElement can have two different kinds of children: another SElement or a ContentItem (which can be marked content (MC), or a PDF object reference (OBJR)).

### Methods

#### <static> create(dict)

  Initialize a SElement using an existing low-level Cos/SDF object.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `dict` | PDFNet.Obj | a low-level (SDF/Cos) dictionary representing the structural element.

  ##### Returns:

  A promise that resolves to an object of type: "selement"

  Type
    PDFNet.SElement

#### <static> createFromPDFDoc(doc, struct_type)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `doc` | PDFNet.PDFDoc |
  `struct_type` | string |

  ##### Returns:

  A promise that resolves to an object of type: "selement"

  Type
    PDFNet.SElement

#### assign(right)

  Copy Constructor

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `right` | PDFNet.SElement |

#### createContentItem(doc, page, insert_before)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `doc` | PDFNet.PDFDoc | The document in which the new ContentItem will be created in.
  `page` | PDFNet.Page | The page object to insert the ContentItem in.
  `insert_before` | number | The position after which the kid is inserted. If element currently has no kids, insert_before is ignored.

  ##### Returns:

  A promise that resolves to an object of type: "number"

  Type
    number

#### getActualText()

  ##### Returns:

  A promise that resolves to the ActualText associated with this element.

  Type
    string

#### getAlt()

  ##### Returns:

  A promise that resolves to the alternate text associated with this element.

  Type
    string

#### getAsContentItem(index)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | number | The index of the kid to obtain.

  ##### Returns:

  A promise that resolves to the kid at a given array index assuming that the kid is a ContentItem.

  Type
    PDFNet.contentitem

#### getAsStructElem(index)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | number | The index of the kid to obtain.

  ##### Returns:

  A promise that resolves to the kid at a given array index assuming that the kid is a SElement.

  Type
    PDFNet.selement

#### getID()

  ##### Returns:

  A promise that resolves to the ID of an element, or NULL if the ID is not defined.

  Type
    PDFNet.Obj

#### getNumKids()

  ##### Returns:

  A promise that resolves to the number of direct kids.

  Type
    number

#### getParent()

  ##### Returns:

  A promise that resolves to the immediate ancestor element of the specified element in the structure tree.

  Type
    PDFNet.selement

#### getSDFObj()

  ##### Returns:

  A promise that resolves to pointer to the underlying SDF/Cos object.

  Type
    PDFNet.Obj

#### getStructTreeRoot()

  ##### Returns:

  A promise that resolves to the structure tree root of the document that directly or indirectly contains this element.

  Type
    PDFNet.STree

#### getTitle()

  ##### Returns:

  A promise that resolves to the title of this structure element.

  Type
    string

#### getType()

  ##### Returns:

  A promise that resolves to the element's structural element type. The type corresponds to the 'S' (i.e. subtype) key in the structure element dictionary.

  The type identifies the nature of the structure element and its role within the document (such as a chapter, paragraph, or footnote).

  Type
    string

#### hasActualText()

  ##### Returns:

  A promise that resolves to if this structure element defines ActualText.

  ActualText is an exact replacement for the structure element and its children. This replacement text is useful when extracting the document's contents in support of accessibility to users with disabilities or for other purposes.

  Type
    boolean

#### hasAlt()

  ##### Returns:

  A promise that resolves to if this structure element defines Alt text.

  Alt text is an alternate description of the structure element and its children in human-readable form, which is useful when extracting the document's contents in support of accessibility.

  Type
    boolean

#### hasTitle()

  ##### Returns:

  A promise that resolves to if this SElement has title.

  The title of the structure element, a text string representing it in human-readable form.

  Type
    boolean

#### insert(kid, insert_before)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `kid` | PDFNet.SElement |
  `insert_before` | number |

#### isContentItem(index)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | number | The index of the kid type to obtain. To retrieve a content item at a given array index use GetAsContentItem(index), otherwise use GetAsStructElem(index)

  ##### Returns:

  A promise that resolves to true if the kid at a given array index is a content item, false otherwise.

  Type
    boolean

#### isValid()

  ##### Returns:

  A promise that resolves to true if this is a valid structure element object, false otherwise.

  Type
    boolean

#### Search results