PDF文本页面表示PDF页面中的所有文本内容,根据为这些文本指定的解析标志。 类 TextPage 可用于检索PDF页面中文本的信息,例如单个字符、单个单词、 指定字符范围或矩形内的文本内容等。
此类对象还可用于构造其他文本相关类的对象,以便对文本内容进行更多操作 或从文本内容访问指定信息:
- 参见
- TextSearch
-
PageTextLinks
◆ GetBaselineRotation()
| def fsdk.TextPage.GetBaselineRotation |
( |
|
rect_index | ) |
|
◆ GetCharCount()
| def fsdk.TextPage.GetCharCount |
( |
| ) |
|
◆ GetCharInfo()
| def fsdk.TextPage.GetCharInfo |
( |
|
char_index | ) |
|
获取特定字符的字符信息。
- 参数
-
- 返回
- 由字符索引指定的字符的字符信息。
◆ GetCharRange()
| def fsdk.TextPage.GetCharRange |
( |
|
rect | ) |
|
获取指定矩形区域内所有文本矩形的字符索引范围。
- 参数
-
- 返回
- 指定矩形区域内所有文本矩形的字符索引范围。
◆ GetChars()
| def fsdk.TextPage.GetChars |
( |
|
start, |
|
|
|
count |
|
) |
| |
获取由起始索引和数量指定范围内的所有字符。
- 参数
-
| [in] | start | 起始字符的索引,它是期望文本内容的第一个字符。 有效范围:从0到(charcount -1)。charcount 由函数 fsdk.TextPage.GetCharCount 返回。默认值:0。 |
| [in] | count | 要检索的字符数量。-1表示获取从start_index到PDF页面末尾的 所有字符。特别地,当参数count 大于(charcount - start),将检索所有剩余字符 (从start_index开始)。charcount 由函数 fsdk.TextPage.GetCharCount 返回。默认值:-1。 |
- 返回
- 指定字符索引范围内的字符。
◆ GetIndexAtPos()
| def fsdk.TextPage.GetIndexAtPos |
( |
|
x, |
|
|
|
y, |
|
|
|
tolerance |
|
) |
| |
获取页面上指定位置处或附近的字符索引, 在中。
- 参数
-
| [in] | x | x位置的值,在中。 |
| [in] | y | y位置的值,在中。 |
| [in] | tolerance | 字符命中检测的容差值,以点为单位。这不应为负数。 |
- 返回
- 位于或接近点(x,y)的字符索引,从0开始。特别地,如果在点(x, y)附近 有多个字符,将返回最小的字符索引。 如果在该点处或附近没有字符,将返回-1。
◆ GetText()
| def fsdk.TextPage.GetText |
( |
|
flag | ) |
|
获取页面文本。
- 参数
-
- 返回
- 相关PDF页面的所有文本内容,按指定的文本顺序。
◆ GetTextInRect()
| def fsdk.TextPage.GetTextInRect |
( |
|
rect | ) |
|
获取矩形内的文本,在中。
- 参数
-
- 返回
- 指定矩形内的文本字符串。
◆ GetTextRect()
| def fsdk.TextPage.GetTextRect |
( |
|
rect_index | ) |
|
通过索引获取文本矩形。
- 参数
-
- 返回
- 指定的文本矩形。
◆ GetTextRectArrayByRect()
| def fsdk.TextPage.GetTextRectArrayByRect |
( |
|
rect | ) |
|
获取指定矩形区域内所有文本矩形的数组。
- 参数
-
- 返回
- 指定矩形内的文本矩形数组。
◆ GetTextRectCount()
| def fsdk.TextPage.GetTextRectCount |
( |
|
start, |
|
|
|
count |
|
) |
| |
计算由起始索引和数量指定范围内的文本矩形。
- 参数
-
| [in] | start | 字符索引范围中起始字符的索引。 有效范围:从0到(charcount -1)。charcount 由函数 fsdk.TextPage.GetCharCount 返回。 |
| [in] | count | 字符索引范围中的字符数量。-1表示获取从start_index到PDF页面末尾的 所有字符。 |
- 返回
- 指定字符索引范围内的文本矩形数量。-1表示错误。
◆ GetTextUnderAnnot()
| def fsdk.TextPage.GetTextUnderAnnot |
( |
|
annot | ) |
|
获取与指定注释相交的页面文本。
如果整个字符或字符的大部分与注释相交, 当前函数将检索此字符。
- 参数
-
- 返回
- 与指定注释相交的文本。
◆ GetWordAtPos()
| def fsdk.TextPage.GetWordAtPos |
( |
|
x, |
|
|
|
y, |
|
|
|
tolerance |
|
) |
| |
获取页面上指定位置处或附近单词的字符范围, 在中。
目前,对于中文/日文/韩文,仅支持获取指定位置处或附近的单个字符。
- 参数
-
| [in] | x | x位置的值,在中。 |
| [in] | y | y位置的值,在中。 |
| [in] | tolerance | 单词命中检测的容差值,以点为单位。这不应为负数。 |
- 返回
- 表示期望单词的字符范围。此范围对象中最多会有一个有效的范围段。 如果返回的范围对象为空,表示未找到此类单词。
◆ IsEmpty()
| def fsdk.TextPage.IsEmpty |
( |
| ) |
|
检查当前对象是否为空。
当前对象为空时,意味着当前对象无用。
- 返回
- true 表示当前对象为空,false 表示不为空。