- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
pdftron::PDF::Struct::SElement Class Reference

`#include <SElement.h>`

## Public Member Functions
| SElement (SDF::Obj dict=SDF::Obj(0))
| SElement (const SElement &)
SElement & | operator= (const SElement &)
void | Insert (SElement &kid, int insert_before)
int | CreateContentItem (PDFDoc &doc, Page &page, int insert_before=-1)
bool | IsValid () const
const char * | GetType () const
int | GetNumKids () const
bool | IsContentItem (int index) const
class ContentItem | GetAsContentItem (int index) const
SElement | GetAsStructElem (int index) const
SElement | GetParent () const
class STree | GetStructTreeRoot () const
bool | HasTitle () const
UString | GetTitle () const
SDF::Obj | GetID () const
bool | HasActualText () const
UString | GetActualText () const
bool | HasAlt () const
UString | GetAlt () const
SDF::Obj | GetSDFObj () const

## Static Public Member Functions
static SElement | Create (pdftron::PDF::PDFDoc &doc, const char *struct_type)

## Detailed Description

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)).

Definition at line 22 of file SElement.h.

## Constructor & Destructor Documentation

pdftron::PDF::Struct::SElement::SElement | ( | SDF::Obj | dict = `SDF::Obj(0)` | ) |

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

Parameters

  dict | - a low-level (SDF/Cos) dictionary representing the structural element.

Note
  This constructor does not copy any data, but is instead the logical equivalent of a type cast.

pdftron::PDF::Struct::SElement::SElement | ( | const SElement & |  | ) |

## Member Function Documentation

static SElement pdftron::PDF::Struct::SElement::Create | ( | pdftron::PDF::PDFDoc & | doc,
|  | const char * | struct_type
| ) |  |
| static

Creates a new SElement.

Parameters

  doc |
  struct_type |

int pdftron::PDF::Struct::SElement::CreateContentItem | ( | PDFDoc & | doc,
|  | Page & | page,
|  | int | insert_before = `-1`
| ) |  |

Parameters

  doc | The document in which the new ContentItem will be created in.
  page | The page object to insert the ContentItem in.
  insert_before | The position after which the kid is inserted. If element currently has no kids, insert_before is ignored.

UString pdftron::PDF::Struct::SElement::GetActualText | ( |  | ) | const

Returns
  The ActualText associated with this element.

Note
  The ActualText can be defined as an empty string. To differentiate between an ActualText string of zero length and no ActualText being defined, use HasActualText().

UString pdftron::PDF::Struct::SElement::GetAlt | ( |  | ) | const

Returns
  The alternate text associated with this element.

Note
  The Alt text can be defined as an empty string. To differentiate between an Alt text string of zero length and no Alt text being defined, use HasAlt().

class ContentItem pdftron::PDF::Struct::SElement::GetAsContentItem | ( | int | index | ) | const

Returns
  The kid at a given array index assuming that the kid is a ContentItem.

Note
  use IsContentItem(index) prior to calling this method to make sure that the kid is indeed a ContentItem.

Parameters

  index | The index of the kid to obtain.

SElement pdftron::PDF::Struct::SElement::GetAsStructElem | ( | int | index | ) | const

Returns
  The kid at a given array index assuming that the kid is a SElement.

Note
  use IsContentItem(index) prior to calling this method to make sure that the kid is not a ContentItem and is another SElement.

Parameters

  index | The index of the kid to obtain.

SDF::Obj pdftron::PDF::Struct::SElement::GetID | ( |  | ) | const

Returns
  the ID of an element, or NULL if the ID is not defined.

int pdftron::PDF::Struct::SElement::GetNumKids | ( |  | ) | const

Returns
  The number of direct kids.

SElement pdftron::PDF::Struct::SElement::GetParent | ( |  | ) | const

Returns
  The immediate ancestor element of the specified element in the structure tree.

Note
  If the element's parent is the structure tree root, the returned SElement will be not valid (i.e. element.IsValid() -> false) and the underlying SDF/Cos object will be NULL.

SDF::Obj pdftron::PDF::Struct::SElement::GetSDFObj | ( |  | ) | const

Returns
  Pointer to the underlying SDF/Cos object.

class STree pdftron::PDF::Struct::SElement::GetStructTreeRoot | ( |  | ) | const

Returns
  The structure tree root of the document that directly or indirectly contains this element.

UString pdftron::PDF::Struct::SElement::GetTitle | ( |  | ) | const

Returns
  The title of this structure element.

const char* pdftron::PDF::Struct::SElement::GetType | ( |  | ) | const

Returns
  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).

bool pdftron::PDF::Struct::SElement::HasActualText | ( |  | ) | const

Returns
  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.

bool pdftron::PDF::Struct::SElement::HasAlt | ( |  | ) | const

Returns
  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.

bool pdftron::PDF::Struct::SElement::HasTitle | ( |  | ) | const

Returns
  if this SElement has title.

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

void pdftron::PDF::Struct::SElement::Insert | ( | SElement & | kid,
|  | int | insert_before
| ) |  |

Inserts the specified kid SElement into this element.

Parameters

  insert_before | The position after which the kid is inserted. If element currently has no kids, insert_before is ignored.

bool pdftron::PDF::Struct::SElement::IsContentItem | ( | int | index | ) | const

Returns
  true if the kid at a given array index is a content item, false otherwise.

Parameters

  index | 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)

bool pdftron::PDF::Struct::SElement::IsValid | ( |  | ) | const

Returns
  true if this is a valid structure element object, false otherwise.

SElement& pdftron::PDF::Struct::SElement::operator= | ( | const SElement & |  | ) |

The documentation for this class was generated from the following file:

- PDF/Struct/SElement.h