Loading...
Searching...
No Matches
pdftron::PDF::Struct::SElement Class Reference

#include <SElement.h>

Public Member Functions

 SElement (SDF::Obj dict=SDF::Obj(0))
 SElement (const SElement &)
SElementoperator= (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

◆ SElement() [1/2]

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.

◆ SElement() [2/2]

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

Member Function Documentation

◆ Create()

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

Creates a new SElement.

Parameters
doc
struct_type

◆ CreateContentItem()

int pdftron::PDF::Struct::SElement::CreateContentItem ( PDFDoc & doc,
Page & page,
int insert_before = -1 )
Parameters
docThe document in which the new ContentItem will be created in.
pageThe page object to insert the ContentItem in.
insert_beforeThe position after which the kid is inserted. If element currently has no kids, insert_before is ignored.

◆ GetActualText()

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

◆ GetAlt()

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

◆ GetAsContentItem()

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
indexThe index of the kid to obtain.

◆ GetAsStructElem()

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
indexThe index of the kid to obtain.

◆ GetID()

SDF::Obj pdftron::PDF::Struct::SElement::GetID ( ) const
Returns
the ID of an element, or NULL if the ID is not defined.

◆ GetNumKids()

int pdftron::PDF::Struct::SElement::GetNumKids ( ) const
Returns
The number of direct kids.

◆ GetParent()

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.

◆ GetSDFObj()

SDF::Obj pdftron::PDF::Struct::SElement::GetSDFObj ( ) const
Returns
Pointer to the underlying SDF/Cos object.

◆ GetStructTreeRoot()

class STree pdftron::PDF::Struct::SElement::GetStructTreeRoot ( ) const
Returns
The structure tree root of the document that directly or indirectly contains this element.

◆ GetTitle()

UString pdftron::PDF::Struct::SElement::GetTitle ( ) const
Returns
The title of this structure element.

◆ GetType()

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

◆ HasActualText()

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.

◆ HasAlt()

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.

◆ HasTitle()

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.

◆ Insert()

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

Inserts the specified kid SElement into this element.

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

◆ IsContentItem()

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
indexThe index of the kid type to obtain.

To retrieve a content item at a given array index use GetAsContentItem(index), otherwise use GetAsStructElem(index)

◆ IsValid()

bool pdftron::PDF::Struct::SElement::IsValid ( ) const
Returns
true if this is a valid structure element object, false otherwise.

◆ operator=()

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

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