ArkoPDF
← SDK API 參考

ipdf_pagetext.h

页面文本:文本的读取与定位。

介面說明保留標頭檔裡的英文原文 —— 照文件寫程式時要能一眼對上程式碼裡的註解。

常數

簽章ValueDescription
PDFFIND_MATCHCASE0x00000001Whether to match the character case(upper or lower).
PDFFIND_MATCHWHOLEWORD0x00000002Whether to match the whole word.
PDFFIND_CONSECUTIVE0x00000004Whether to do consecutive searching.

class IPDF_PageText

PDF Text Page Interface.

方法(26)

簽章說明
Release()Release the PDF texgt page.
GetAllText(char* in_out_buf, int* in_out_buflen)Get all text in a page.
GetAllText_Unicode(wchar_t* in_out_buf, int* in_out_buflen)Unicode version for getting all text in a page.
ParseText()Parse page text.
IsParsed()Test whether the page text is parsed.
CountChars()Count characters in a page.
GetCaret(const PDSDK_FloatPoint* point, float xTorelance, float yTore…)Get text caret index at specificed point.
GetCaretPos(int caret, PDSDK_FloatPoint* top, PDSDK_FloatPoint* bottom)Get text caret position.
GetNextCaret(int caret, int direct)Get next text caret.
GetSelectedChars(int caret_start, int caret_end)Get selected text.
GetSelCharUTF8(int caret_start, int caret_end)UTF8 version for getting selected text.
CountSelectedCharBox(int caret_start, int caret_end)Count the selected text's rectangle.
GetSelectedCharBox(int index, PDSDK_FloatRect* rect)Get selected text's rectangle.
GetTextByRect(const PDSDK_FloatRect* rect)Get text in specificed rectangle.
GetTextByRectUTF8(const PDSDK_FloatRect* rect)Get text in specificed rectangle.
GetWordBreak(int caret, int direction)Not support now.
FindFirst(const wchar_t* find_what, int find_flag, int start_pos = 0)Find the first match with specified find flags, optionally with a start position..
FindNext()Find the next match.
FindPrev()Find the previous match.
GetCurFindOrder()Get the current order.
GetMatchedCount()Get the count of current matches.
GetMatchedTextRectCount()Get the count of rectangle of current matches.
GetMatchedTextRect(int index, PDSDK_FloatRect* rect)Get matched text's rectangle by specified index.
GetTextAbstract(int start, int count)Get text line which contain the match.
GetTextAbstract_Unicode(int start, int count)Get text line which contain the match(Unicode version).
GetWordAt(int caret, int& iStart, int& iEnd)Get the word which contain the specified text caret.
GetAllText
int GetAllText(char* in_out_buf, int* in_out_buflen) = 0;

Get all text in a page.

參數

  • in_out_buf(in/out) — A buffer to receiv the text.
  • in_out_buflen(in/out) — Length of in_out_buf buffer.

傳回值:1 for success, 0 for failure.

GetAllText_Unicode
int GetAllText_Unicode(wchar_t* in_out_buf, int* in_out_buflen) = 0;

Unicode version for getting all text in a page.

參數

  • in_out_buf(in/out) — A buffer to receiv the text.
  • in_out_buflen(in/out) — Length of in_out_buf buffer.

傳回值:1 for success, 0 for failure.

ParseText
int ParseText() = 0;

Parse page text.

傳回值:1 for success, 0 for failure.

IsParsed
int IsParsed() = 0;

Test whether the page text is parsed.

傳回值:1 for parsed, 0 for not parsed.

CountChars
int CountChars() = 0;

Count characters in a page.

傳回值:The total number of characters in a page.

GetCaret
int GetCaret(const PDSDK_FloatPoint* point, float xTorelance, float yTorelance) = 0;

Get text caret index at specificed point.

參數

  • point(in) — The point in user space.
  • xTorelance(in) — X-direction torelance.
  • yTorelance(in) — Y-direction torelance.

傳回值:The zero-based caret index. Less than zero means no character at specificed point.

GetCaretPos
int GetCaretPos(int caret, PDSDK_FloatPoint* top, PDSDK_FloatPoint* bottom) = 0;

Get text caret position.

參數

  • caret(in) — The caret index.
  • top(out) — Top point in user space.
  • bottom(out) — Bottom point in user space.

傳回值:1 for success, 0 for failure.

GetNextCaret
int GetNextCaret(int caret, int direct) = 0;

Get next text caret.

參數

  • caret(in) — The caret index.
  • direct(in) — The direction for next caret. @see Caret direction flags

傳回值:The next caret index, less 0 means no caret.

GetSelectedChars
const wchar_t* GetSelectedChars(int caret_start, int caret_end) = 0;

Get selected text.

參數

  • caret_start(in) — The start caret of selected chars.
  • caret_end(out) — The end caret of selected chars.

傳回值:The selected char's unicodes.

GetSelCharUTF8
const char* GetSelCharUTF8(int caret_start, int caret_end) = 0;

UTF8 version for getting selected text.

參數

  • caret_start(in) — The start caret of selected chars.
  • caret_end(in) — The end caret of selected chars.

傳回值:The selected char's utf8.

CountSelectedCharBox
int CountSelectedCharBox(int caret_start, int caret_end) = 0;

Count the selected text's rectangle.

參數

  • caret_start(in) — The start caret of selected chars.
  • caret_end(in) — The end caret of selected chars.

傳回值:The number of rectangles whitch used to hilight.

GetSelectedCharBox
int GetSelectedCharBox(int index, PDSDK_FloatRect* rect) = 0;

Get selected text's rectangle.

參數

  • index(in) — The zero-based rectangle index, range is 0 to CountSelectedCharBox()-1.
  • rect(in) — The rectangle of specificed caret.

傳回值:1 for success, 0 for failure.

GetTextByRect
const wchar_t* GetTextByRect(const PDSDK_FloatRect* rect) = 0;

Get text in specificed rectangle.

參數

  • rect(in) — The rectangle.

傳回值:The selected unicodes.

GetTextByRectUTF8
const char* GetTextByRectUTF8(const PDSDK_FloatRect* rect) = 0;

Get text in specificed rectangle.

參數

  • rect(in) — The rectangle.

傳回值:The selected utf8s.

FindFirst
int FindFirst(const wchar_t* find_what, int find_flag, int start_pos = 0) = 0;

Find the first match with specified find flags, optionally with a start position..

參數

  • find_what(in) — The word to be matched.
  • find_flag(in) — The find flags. @see Find flags.
  • start_pos(in) — The find start position, an zero-based position.

傳回值:1 for success, 0 for failure.

FindNext
int FindNext() = 0;

Find the next match.

傳回值:1 for success, 0 for failure.

FindPrev
int FindPrev() = 0;

Find the previous match.

傳回值:1 for success, 0 for failure.

GetMatchedTextRect
void GetMatchedTextRect(int index, PDSDK_FloatRect* rect) = 0;

Get matched text's rectangle by specified index.

參數

  • index(in) — The zero-based rectangle index. Range is from 0 to GetMatchedTextRectCount().
  • rect(out) — Receiv the rectangle.
GetTextAbstract
const char* GetTextAbstract(int start, int count) = 0;

Get text line which contain the match.

參數

  • start(in) — The first char order of match.
  • count(in) — The count of match.

傳回值:The text line of specified match.

GetTextAbstract_Unicode
const wchar_t* GetTextAbstract_Unicode(int start, int count) = 0;

Get text line which contain the match(Unicode version).

參數

  • start(in) — The first char order of match.
  • count(in) — The count of match.

傳回值:The text line of specified match.

GetWordAt
const wchar_t* GetWordAt(int caret, int& iStart, int& iEnd) = 0;

Get the word which contain the specified text caret.

參數

  • caret(in) — The text caret index.
  • iStart(out) — The start caret of word.
  • iEnd(out) — The end caret of word.

傳回值:The word's unicodes.