Foxit PDF SDK
fsdk.TextObject Class Reference

Public Member Functions

def GetCharCount ()
 Get character count in current text object. More...
 
def GetCharHeightByIndex (index)
 Get the height of a character specified by index in current text object. More...
 
def GetCharPos (index)
 Get the position of a character specified by index in current text object. More...
 
def GetCharWidthByIndex (index)
 Get the width of a character specified by index in current text object. More...
 
def GetText ()
 Get text string. More...
 
def GetTextState (page)
 Get text state information. More...
 
def SetText (text)
 Set text string. More...
 
def SetTextState (page, text_state, is_italic, weight)
 Set text state information. More...
 

Detailed Description

Text graphics object is a kind of PDF graphics object, so class TextObject is derived from class GraphicsObject . It offers functions to get/set text graphics object's data.
To create a new text graphics object, please use function fsdk.TextObjectCreate and then use setting functions to set information to the new text graphics object.

See also
GraphicsObject

Member Function Documentation

◆ GetCharCount()

def fsdk.TextObject.GetCharCount ( )

Get character count in current text object.

Returns
Character count.

◆ GetCharHeightByIndex()

def fsdk.TextObject.GetCharHeightByIndex (   index)

Get the height of a character specified by index in current text object.

Parameters
[in]indexThe index of character whose position is to be retrieved. Valid range: from 0 to (count-1). count is returned by function fsdk.TextObject.GetCharCount .
Returns
Height of the specified character.

◆ GetCharPos()

def fsdk.TextObject.GetCharPos (   index)

Get the position of a character specified by index in current text object.

Parameters
[in]indexThe index of character whose position is to be retrieved. Valid range: from 0 to (count-1). count is returned by function fsdk.TextObject.GetCharCount .
Returns
Position of the specified character, in [PDF coordinate system] ().

◆ GetCharWidthByIndex()

def fsdk.TextObject.GetCharWidthByIndex (   index)

Get the width of a character specified by index in current text object.

Parameters
[in]indexThe index of character whose position is to be retrieved. Valid range: from 0 to (count-1). count is returned by function fsdk.TextObject.GetCharCount .
Returns
Width of the specified character.

◆ GetText()

def fsdk.TextObject.GetText ( )

Get text string.

Returns
Text string.

◆ GetTextState()

def fsdk.TextObject.GetTextState (   page)

Get text state information.

Parameters
[in]pageA valid PDF page.Please ensure that current graphics object just belongs to this page.
Returns
Text state information.

◆ SetText()

def fsdk.TextObject.SetText (   text)

Set text string.

Parameters
[in]textNew text string.
Returns
None.
Note
Before setting text, please ensure that current text graphics object has valid font which is a part of text state. If not, please call function fsdk.TextObject.SetTextState to set valid font first; otherwise setting text will fail.
When this function succeeds, function fsdk.GraphicsObjects.GenerateContent should be called. Please refer to function fsdk.GraphicsObjects.GenerateContent for more details.

◆ SetTextState()

def fsdk.TextObject.SetTextState (   page,
  text_state,
  is_italic,
  weight 
)

Set text state information.

Parameters
[in]pageA valid PDF page.Please ensure that current graphics object just belongs to this page.
[in]text_stateNew text state information.
[in]is_italictrue means the text of current graphics object is italic, while false means not.
[in]weightOriginal font weight. If the value is larger than 500, that means to use bold.
Returns
None.
Note
When this function succeeds, function fsdk.GraphicsObjects.GenerateContent should be called. Please refer to function fsdk.GraphicsObjects.GenerateContent for more details.