pdftron::PDF::Struct::SElement Class Reference

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

#include <SElement.h>

List of all members.

Public Member Functions

 SElement (SDF::Obj dict=SDF::Obj(0))
 Initialize a SElement using an existing low-level Cos/SDF object.
 SElement (const SElement &)
SElementoperator= (const SElement &)
bool IsValid () const
 
Returns:
true if this is a valid structure element object, false otherwise.

const char * GetType () const
 
Returns:
The element's structural element type.

int GetNumKids () const
 
Returns:
The number of direct kids.

bool IsContentItem (int index) const
 
Returns:
true if the kid at a given array index is a content item, false otherwise.

class ContentItem GetAsContentItem (int index) const
 
Returns:
The kid at a given array index assuming that the kid is a ContentItem.

SElement GetAsStructElem (int index) const
 
Returns:
The kid at a given array index assuming that the kid is a SElement.

SElement GetParent () const
 
Returns:
The immediate ancestor element of the specified element in the structure tree.

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

bool HasTitle () const
 
Returns:
if this SElement has title.

UString GetTitle () const
 
Returns:
The title of this structure element.

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

bool HasActualText () const
 
Returns:
if this structure element defines ActualText.

UString GetActualText () const
 
Returns:
The ActualText associated with this element.

bool HasAlt () const
 
Returns:
if this structure element defines Alt text.

UString GetAlt () const
 
Returns:
The alternate text associated with this element.

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


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


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

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

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

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

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

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

Returns:
The number of direct kids.

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)

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.

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.

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

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

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.

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

Returns:
The title of this structure element.

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

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

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.

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

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.

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

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

Returns:
Pointer to the underlying SDF/Cos object.


© 2002-2008 PDFTron Systems Inc.