|
Foxit PDF SDK
|
Public 类型 | |
| enum | TextOrderFlag { e_TextStreamOrder = 0, e_TextDisplayOrder = 1 } |
| 获取PDF页面文本内容时使用的文本顺序标志枚举。 更多... | |
| enum | TextParseFlags { e_ParseTextNormal = 0x0000, e_ParseTextOutputHyphen = 0x0001, e_ParseTextUseStreamOrder = 0x0002 } |
| 用于文本页面的解析标志枚举。 更多... | |
Public 成员函数 | |
| TextPage (const PDFPage &page, int flags=foxit::pdf::TextPage::e_ParseTextNormal) | |
| 从已解析的PDF页面构造函数。 更多... | |
| TextPage (const TextPage &other) | |
| 用另一个文本页面对象的构造函数。 更多... | |
| ~TextPage () | |
| 析构函数。 | |
| common::Rotation | GetBaselineRotation (int rect_index) |
| 获取指定矩形的文本趋势(作为旋转)。 更多... | |
| int | GetCharCount () const |
| 获取所有字符的数量。 更多... | |
| TextPageCharInfo | GetCharInfo (int char_index) |
| 获取特定字符的字符信息。 更多... | |
| common::Range | GetCharRange (const RectF &rect) |
| 获取指定矩形区域内所有文本矩形的字符索引范围。 更多... | |
| WString | GetChars (int start=0, int count=-1) const |
| 获取由起始索引和数量指定范围内的所有字符。 更多... | |
| int | GetIndexAtPos (float x, float y, float tolerance) const |
| 获取页面上指定位置处或附近的字符索引, 在PDF坐标系统中。 更多... | |
| WString | GetText (TextOrderFlag flag) const |
| 获取页面文本。 更多... | |
| WString | GetTextInRect (const RectF &rect) const |
| 获取矩形内的文本,在PDF坐标系统中。 更多... | |
| RectF | GetTextRect (int rect_index) const |
| 通过索引获取文本矩形。 更多... | |
| RectFArray | GetTextRectArrayByRect (const RectF &rect) |
| 获取指定矩形区域内所有文本矩形的数组。 更多... | |
| int | GetTextRectCount (int start=0, int count=-1) |
| 计算由起始索引和数量指定范围内的文本矩形。 更多... | |
| WString | GetTextUnderAnnot (annots::Annot &annot) const |
| 获取与指定注释相交的页面文本。 更多... | |
| common::Range | GetWordAtPos (float x, float y, float tolerance) const |
| 获取页面上指定位置处或附近单词的字符范围, 在PDF坐标系统中。 更多... | |
| bool | IsEmpty () const |
| 检查当前对象是否为空。 更多... | |
| bool | operator != (const TextPage &other) const |
| 不等于操作符。 更多... | |
| TextPage & | operator= (const TextPage &other) |
| 赋值操作符。 更多... | |
| bool | operator== (const TextPage &other) const |
| 等于操作符。 更多... | |
Public 成员函数 继承自 foxit::Base | |
| FS_HANDLE | Handle () const |
| 获取当前对象的句柄。 更多... | |
PDF文本页面表示PDF页面中的所有文本内容,根据为这些文本指定的解析标志。 类 TextPage 可用于检索PDF页面中文本的信息,例如单个字符、单个单词、 指定字符范围或矩形内的文本内容等。
此类对象还可用于构造其他文本相关类的对象,以便对文本内容进行更多操作 或从文本内容访问指定信息:
|
explicit |
从已解析的PDF页面构造函数。
| [in] | page | 有效的PDF页面对象。此页面应已被解析。 |
| [in] | flags | 文本页面的解析标志。请参考从 TextPage::e_ParseTextNormal 开始的值,这可以是这些值中的一个或组合。 |
| foxit::pdf::TextPage::TextPage | ( | const TextPage & | other | ) |
用另一个文本页面对象的构造函数。
| [in] | other | 另一个文本页面对象。 |
| common::Rotation foxit::pdf::TextPage::GetBaselineRotation | ( | int | rect_index | ) |
获取指定矩形的文本趋势(作为旋转)。
| [in] | rect_index | 要检索的矩形的索引。 有效范围:从0到(count -1)。count 由函数 TextPage::GetTextRectCount 返回。 |
| int foxit::pdf::TextPage::GetCharCount | ( | ) | const |
获取所有字符的数量。
| TextPageCharInfo foxit::pdf::TextPage::GetCharInfo | ( | int | char_index | ) |
获取特定字符的字符信息。
| [in] | char_index | 字符的从零开始的索引。 范围:从0到(charcount - 1)。charcount 由函数 TextPage::GetCharCount 返回。 |
| common::Range foxit::pdf::TextPage::GetCharRange | ( | const RectF & | rect | ) |
| WString foxit::pdf::TextPage::GetChars | ( | int | start = 0, |
| int | count = -1 |
||
| ) | const |
获取由起始索引和数量指定范围内的所有字符。
| [in] | start | 起始字符的索引,它是期望文本内容的第一个字符。 有效范围:从0到(charcount -1)。charcount 由函数 TextPage::GetCharCount 返回。默认值:0。 |
| [in] | count | 要检索的字符数量。-1表示获取从start_index到PDF页面末尾的 所有字符。特别地,当参数count 大于(charcount - start),将检索所有剩余字符 (从start_index开始)。charcount 由函数 TextPage::GetCharCount 返回。默认值:-1。 |
| int foxit::pdf::TextPage::GetIndexAtPos | ( | float | x, |
| float | y, | ||
| float | tolerance | ||
| ) | const |
| WString foxit::pdf::TextPage::GetText | ( | TextOrderFlag | flag | ) | const |
获取页面文本。
| [in] | flag | 文本顺序标志,决定如何获取相关PDF页面的文本内容。请参考从 TextPage::e_TextStreamOrder 开始的值,这应该是这些值中的一个。 |
| RectF foxit::pdf::TextPage::GetTextRect | ( | int | rect_index | ) | const |
通过索引获取文本矩形。
| [in] | rect_index | 要检索的矩形的索引。 有效范围:从0到(count -1)。count 由函数 TextPage::GetTextRectCount 返回。 |
| RectFArray foxit::pdf::TextPage::GetTextRectArrayByRect | ( | const RectF & | rect | ) |
| int foxit::pdf::TextPage::GetTextRectCount | ( | int | start = 0, |
| int | count = -1 |
||
| ) |
计算由起始索引和数量指定范围内的文本矩形。
| [in] | start | 字符索引范围中起始字符的索引。 有效范围:从0到(charcount -1)。charcount 由函数 TextPage::GetCharCount 返回。 |
| [in] | count | 字符索引范围中的字符数量。-1表示获取从start_index到PDF页面末尾的 所有字符。 |
| WString foxit::pdf::TextPage::GetTextUnderAnnot | ( | annots::Annot & | annot | ) | const |
获取与指定注释相交的页面文本。
如果整个字符或字符的大部分与注释相交, 当前函数将检索此字符。
| [in] | annot | 注释。要检索与此注释相交的页面文本。 目前,仅支持文本标记注释 (高亮/下划线/删除线/波浪线注释);对于其他类型的注释, 此函数将抛出异常 foxit::e_ErrUnsupported。 |
| common::Range foxit::pdf::TextPage::GetWordAtPos | ( | float | x, |
| float | y, | ||
| float | tolerance | ||
| ) | const |
| bool foxit::pdf::TextPage::IsEmpty | ( | ) | const |
检查当前对象是否为空。
当前对象为空时,意味着当前对象无用。
| bool foxit::pdf::TextPage::operator != | ( | const TextPage & | other | ) | const |
不等于操作符。
| [in] | other | 另一个文本页面对象。此函数将检查当前对象是否不等于这个对象。 |
赋值操作符。
| [in] | other | 另一个文本页面对象,其值将被赋给当前对象。 |
| bool foxit::pdf::TextPage::operator== | ( | const TextPage & | other | ) | const |
等于操作符。
| [in] | other | 另一个文本页面对象。此函数将检查当前对象是否等于这个对象。 |