| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef PUBLIC_FPDF_TEXT_H_ | 7 #ifndef PUBLIC_FPDF_TEXT_H_ |
| 8 #define PUBLIC_FPDF_TEXT_H_ | 8 #define PUBLIC_FPDF_TEXT_H_ |
| 9 | 9 |
| 10 #include "fpdfview.h" | 10 #include "fpdfview.h" |
| 11 | 11 |
| 12 // Exported Functions | 12 // Exported Functions |
| 13 #ifdef __cplusplus | 13 #ifdef __cplusplus |
| 14 extern "C" { | 14 extern "C" { |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 // Function: FPDFText_LoadPage | 17 // Function: FPDFText_LoadPage |
| 18 // Prepare information about all characters in a page. | 18 // Prepare information about all characters in a page. |
| 19 // Parameters: | 19 // Parameters: |
| 20 // page - Handle to the page. Returned by FPDF_LoadPage function (
in FPDFVIEW module). | 20 // page - Handle to the page. Returned by FPDF_LoadPage function |
| 21 // (in FPDFVIEW module). |
| 21 // Return value: | 22 // Return value: |
| 22 // A handle to the text page information structure. | 23 // A handle to the text page information structure. |
| 23 // NULL if something goes wrong. | 24 // NULL if something goes wrong. |
| 24 // Comments: | 25 // Comments: |
| 25 // Application must call FPDFText_ClosePage to release the text page in
formation. | 26 // Application must call FPDFText_ClosePage to release the text page |
| 27 // information. |
| 26 // | 28 // |
| 27 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page); | 29 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page); |
| 28 | 30 |
| 29 // Function: FPDFText_ClosePage | 31 // Function: FPDFText_ClosePage |
| 30 // Release all resources allocated for a text page information structur
e. | 32 // Release all resources allocated for a text page information |
| 33 // structure. |
| 31 // Parameters: | 34 // Parameters: |
| 32 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 35 // text_page - Handle to a text page information structure. |
| 36 // Returned by FPDFText_LoadPage function. |
| 33 // Return Value: | 37 // Return Value: |
| 34 // None. | 38 // None. |
| 35 // | 39 // |
| 36 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page); | 40 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page); |
| 37 | 41 |
| 38 // Function: FPDFText_CountChars | 42 // Function: FPDFText_CountChars |
| 39 // Get number of characters in a page. | 43 // Get number of characters in a page. |
| 40 // Parameters: | 44 // Parameters: |
| 41 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 45 // text_page - Handle to a text page information structure. |
| 46 // Returned by FPDFText_LoadPage function. |
| 42 // Return value: | 47 // Return value: |
| 43 // Number of characters in the page. Return -1 for error. | 48 // Number of characters in the page. Return -1 for error. |
| 44 // Generated characters, like additional space characters, new line cha
racters, are also counted. | 49 // Generated characters, like additional space characters, new line |
| 50 // characters, are also counted. |
| 45 // Comments: | 51 // Comments: |
| 46 // Characters in a page form a "stream", inside the stream, each charac
ter has an index. | 52 // Characters in a page form a "stream", inside the stream, each |
| 47 // We will use the index parameters in many of FPDFTEXT functions. The
first character in the page | 53 // character has an index. |
| 54 // We will use the index parameters in many of FPDFTEXT functions. The |
| 55 // first character in the page |
| 48 // has an index value of zero. | 56 // has an index value of zero. |
| 49 // | 57 // |
| 50 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page); | 58 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page); |
| 51 | 59 |
| 52 // Function: FPDFText_GetUnicode | 60 // Function: FPDFText_GetUnicode |
| 53 // Get Unicode of a character in a page. | 61 // Get Unicode of a character in a page. |
| 54 // Parameters: | 62 // Parameters: |
| 55 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 63 // text_page - Handle to a text page information structure. |
| 64 // Returned by FPDFText_LoadPage function. |
| 56 // index - Zero-based index of the character. | 65 // index - Zero-based index of the character. |
| 57 // Return value: | 66 // Return value: |
| 58 // The Unicode of the particular character. | 67 // The Unicode of the particular character. |
| 59 // If a character is not encoded in Unicode and Foxit engine can't conv
ert to Unicode, | 68 // If a character is not encoded in Unicode and Foxit engine can't |
| 69 // convert to Unicode, |
| 60 // the return value will be zero. | 70 // the return value will be zero. |
| 61 // | 71 // |
| 62 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int
index); | 72 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, |
| 73 int index); |
| 63 | 74 |
| 64 // Function: FPDFText_GetFontSize | 75 // Function: FPDFText_GetFontSize |
| 65 // Get the font size of a particular character. | 76 // Get the font size of a particular character. |
| 66 // Parameters: | 77 // Parameters: |
| 67 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 78 // text_page - Handle to a text page information structure. |
| 79 // Returned by FPDFText_LoadPage function. |
| 68 // index - Zero-based index of the character. | 80 // index - Zero-based index of the character. |
| 69 // Return value: | 81 // Return value: |
| 70 // The font size of the particular character, measured in points (about
1/72 inch). | 82 // The font size of the particular character, measured in points (about |
| 83 // 1/72 inch). |
| 71 // This is the typographic size of the font (so called "em size"). | 84 // This is the typographic size of the font (so called "em size"). |
| 72 // | 85 // |
| 73 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, int index
); | 86 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, |
| 87 int index); |
| 74 | 88 |
| 75 // Function: FPDFText_GetCharBox | 89 // Function: FPDFText_GetCharBox |
| 76 // Get bounding box of a particular character. | 90 // Get bounding box of a particular character. |
| 77 // Parameters: | 91 // Parameters: |
| 78 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 92 // text_page - Handle to a text page information structure. |
| 93 // Returned by FPDFText_LoadPage function. |
| 79 // index - Zero-based index of the character. | 94 // index - Zero-based index of the character. |
| 80 // left - Pointer to a double number receiving left position o
f the character box. | 95 // left - Pointer to a double number receiving left position |
| 81 // right - Pointer to a double number receiving right position
of the character box. | 96 // of the character box. |
| 82 // bottom - Pointer to a double number receiving bottom position
of the character box. | 97 // right - Pointer to a double number receiving right position |
| 83 // top - Pointer to a double number receiving top position of
the character box. | 98 // of the character box. |
| 99 // bottom - Pointer to a double number receiving bottom position |
| 100 // of the character box. |
| 101 // top - Pointer to a double number receiving top position of |
| 102 // the character box. |
| 84 // Return Value: | 103 // Return Value: |
| 85 // None. | 104 // None. |
| 86 // Comments: | 105 // Comments: |
| 87 // All positions are measured in PDF "user space". | 106 // All positions are measured in PDF "user space". |
| 88 // | 107 // |
| 89 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, int index, d
ouble* left, | 108 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, |
| 90 double* right, double* botto
m, double* top); | 109 int index, |
| 110 double* left, |
| 111 double* right, |
| 112 double* bottom, |
| 113 double* top); |
| 91 | 114 |
| 92 // Function: FPDFText_GetCharIndexAtPos | 115 // Function: FPDFText_GetCharIndexAtPos |
| 93 // Get the index of a character at or nearby a certain position on the
page. | 116 // Get the index of a character at or nearby a certain position on the |
| 94 // Parameters: | 117 // page. |
| 95 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 118 // Parameters: |
| 119 // text_page - Handle to a text page information structure. |
| 120 // Returned by FPDFText_LoadPage function. |
| 96 // x - X position in PDF "user space". | 121 // x - X position in PDF "user space". |
| 97 // y - Y position in PDF "user space". | 122 // y - Y position in PDF "user space". |
| 98 // xTolerance - An x-axis tolerance value for character hit detectio
n, in point unit. | 123 // xTolerance - An x-axis tolerance value for character hit |
| 99 // yTolerance - A y-axis tolerance value for character hit detection
, in point unit. | 124 // detection, in point unit. |
| 125 // yTolerance - A y-axis tolerance value for character hit |
| 126 // detection, in point unit. |
| 100 // Return Value: | 127 // Return Value: |
| 101 // The zero-based index of the character at, or nearby the point (x,y). | 128 // The zero-based index of the character at, or nearby the point (x,y). |
| 102 // If there is no character at or nearby the point, return value will b
e -1. | 129 // If there is no character at or nearby the point, return value will |
| 130 // be -1. |
| 103 // If an error occurs, -3 will be returned. | 131 // If an error occurs, -3 will be returned. |
| 104 // | 132 // |
| 105 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, | 133 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, |
| 106 double x, double y, double xTor
elance, double yTolerance); | 134 double x, |
| 135 double y, |
| 136 double xTorelance, |
| 137 double yTolerance); |
| 107 | 138 |
| 108 // Function: FPDFText_GetText | 139 // Function: FPDFText_GetText |
| 109 // Extract unicode text string from the page. | 140 // Extract unicode text string from the page. |
| 110 // Parameters: | 141 // Parameters: |
| 111 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 142 // text_page - Handle to a text page information structure. |
| 143 // Returned by FPDFText_LoadPage function. |
| 112 // start_index - Index for the start characters. | 144 // start_index - Index for the start characters. |
| 113 // count - Number of characters to be extracted. | 145 // count - Number of characters to be extracted. |
| 114 // result - A buffer (allocated by application) receiving the ex
tracted unicodes. | 146 // result - A buffer (allocated by application) receiving the |
| 115 // The size of the buffer must be able to hold the numb
er of characters plus a terminator. | 147 // extracted unicodes. |
| 116 // Return Value: | 148 // The size of the buffer must be able to hold the |
| 117 // Number of characters written into the result buffer, including the t
railing terminator. | 149 // number of characters plus a terminator. |
| 150 // Return Value: |
| 151 // Number of characters written into the result buffer, including the |
| 152 // trailing terminator. |
| 118 // Comments: | 153 // Comments: |
| 119 // This function ignores characters without unicode information. | 154 // This function ignores characters without unicode information. |
| 120 // | 155 // |
| 121 DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, int start_index,
int count, unsigned short* result); | 156 DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, |
| 157 int start_index, |
| 158 int count, |
| 159 unsigned short* result); |
| 122 | 160 |
| 123 // Function: FPDFText_CountRects | 161 // Function: FPDFText_CountRects |
| 124 // Count number of rectangular areas occupied by a segment of texts. | 162 // Count number of rectangular areas occupied by a segment of texts. |
| 125 // Parameters: | 163 // Parameters: |
| 126 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 164 // text_page - Handle to a text page information structure. |
| 165 // Returned by FPDFText_LoadPage function. |
| 127 // start_index - Index for the start characters. | 166 // start_index - Index for the start characters. |
| 128 // count - Number of characters. | 167 // count - Number of characters. |
| 129 // Return value: | 168 // Return value: |
| 130 // Number of rectangles. Zero for error. | 169 // Number of rectangles. Zero for error. |
| 131 // Comments: | 170 // Comments: |
| 132 // This function, along with FPDFText_GetRect can be used by applicatio
ns to detect the position | 171 // This function, along with FPDFText_GetRect can be used by |
| 133 // on the page for a text segment, so proper areas can be highlighted o
r something. | 172 // applications to detect the position |
| 134 // FPDFTEXT will automatically merge small character boxes into bigger
one if those characters | 173 // on the page for a text segment, so proper areas can be highlighted |
| 174 // or something. |
| 175 // FPDFTEXT will automatically merge small character boxes into bigger |
| 176 // one if those characters |
| 135 // are on the same line and use same font settings. | 177 // are on the same line and use same font settings. |
| 136 // | 178 // |
| 137 DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, int start_ind
ex, int count); | 179 DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, |
| 180 int start_index, |
| 181 int count); |
| 138 | 182 |
| 139 // Function: FPDFText_GetRect | 183 // Function: FPDFText_GetRect |
| 140 // Get a rectangular area from the result generated by FPDFText_CountRe
cts. | 184 // Get a rectangular area from the result generated by |
| 141 // Parameters: | 185 // FPDFText_CountRects. |
| 142 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 186 // Parameters: |
| 187 // text_page - Handle to a text page information structure. |
| 188 // Returned by FPDFText_LoadPage function. |
| 143 // rect_index - Zero-based index for the rectangle. | 189 // rect_index - Zero-based index for the rectangle. |
| 144 // left - Pointer to a double value receiving the rectangle le
ft boundary. | 190 // left - Pointer to a double value receiving the rectangle |
| 145 // top - Pointer to a double value receiving the rectangle to
p boundary. | 191 // left boundary. |
| 146 // right - Pointer to a double value receiving the rectangle ri
ght boundary. | 192 // top - Pointer to a double value receiving the rectangle |
| 147 // bottom - Pointer to a double value receiving the rectangle bo
ttom boundary. | 193 // top boundary. |
| 194 // right - Pointer to a double value receiving the rectangle |
| 195 // right boundary. |
| 196 // bottom - Pointer to a double value receiving the rectangle |
| 197 // bottom boundary. |
| 148 // Return Value: | 198 // Return Value: |
| 149 // None. | 199 // None. |
| 150 // | 200 // |
| 151 DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, int rect_index,
double* left, double* top, | 201 DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, |
| 152 double* right, double* bottom); | 202 int rect_index, |
| 203 double* left, |
| 204 double* top, |
| 205 double* right, |
| 206 double* bottom); |
| 153 | 207 |
| 154 // Function: FPDFText_GetBoundedText | 208 // Function: FPDFText_GetBoundedText |
| 155 // Extract unicode text within a rectangular boundary on the page. | 209 // Extract unicode text within a rectangular boundary on the page. |
| 156 // Parameters: | 210 // Parameters: |
| 157 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 211 // text_page - Handle to a text page information structure. |
| 212 // Returned by FPDFText_LoadPage function. |
| 158 // left - Left boundary. | 213 // left - Left boundary. |
| 159 // top - Top boundary. | 214 // top - Top boundary. |
| 160 // right - Right boundary. | 215 // right - Right boundary. |
| 161 // bottom - Bottom boundary. | 216 // bottom - Bottom boundary. |
| 162 // buffer - A unicode buffer. | 217 // buffer - A unicode buffer. |
| 163 // buflen - Number of characters (not bytes) for the buffer, exc
luding an additional terminator. | 218 // buflen - Number of characters (not bytes) for the buffer, |
| 164 // Return Value: | 219 // excluding an additional terminator. |
| 165 // If buffer is NULL or buflen is zero, return number of characters (no
t bytes) of text present within | 220 // Return Value: |
| 166 // the rectangle, excluding a terminating NUL. Generally you should pa
ss a buffer at least one larger | 221 // If buffer is NULL or buflen is zero, return number of characters |
| 167 // than this if you want a terminating NUL, which will be provided if s
pace is available. | 222 // (not bytes) of text present within |
| 168 // Otherwise, return number of characters copied into the buffer, inclu
ding the terminating NUL | 223 // the rectangle, excluding a terminating NUL. Generally you should |
| 224 // pass a buffer at least one larger |
| 225 // than this if you want a terminating NUL, which will be provided if |
| 226 // space is available. |
| 227 // Otherwise, return number of characters copied into the buffer, |
| 228 // including the terminating NUL |
| 169 // when space for it is available. | 229 // when space for it is available. |
| 170 // Comment: | 230 // Comment: |
| 171 // If the buffer is too small, as much text as will fit is copied into
it. | 231 // If the buffer is too small, as much text as will fit is copied into |
| 172 // | 232 // it. |
| 173 DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double lef
t, double top, | 233 // |
| 174 double right, double bottom,unsign
ed short* buffer,int buflen); | 234 DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, |
| 175 | 235 double left, |
| 236 double top, |
| 237 double right, |
| 238 double bottom, |
| 239 unsigned short* buffer, |
| 240 int buflen); |
| 176 | 241 |
| 177 // Flags used by FPDFText_FindStart function. | 242 // Flags used by FPDFText_FindStart function. |
| 178 #define FPDF_MATCHCASE 0x00000001 //If not set, it will not match case
by default. | 243 #define FPDF_MATCHCASE \ |
| 179 #define FPDF_MATCHWHOLEWORD 0x00000002 //If not set, it will not match the
whole word by default. | 244 0x00000001 // If not set, it will not match case by default. |
| 245 #define FPDF_MATCHWHOLEWORD \ |
| 246 0x00000002 // If not set, it will not match the whole word by default. |
| 180 | 247 |
| 181 // Function: FPDFText_FindStart | 248 // Function: FPDFText_FindStart |
| 182 // Start a search. | 249 // Start a search. |
| 183 // Parameters: | 250 // Parameters: |
| 184 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 251 // text_page - Handle to a text page information structure. |
| 252 // Returned by FPDFText_LoadPage function. |
| 185 // findwhat - A unicode match pattern. | 253 // findwhat - A unicode match pattern. |
| 186 // flags - Option flags. | 254 // flags - Option flags. |
| 187 // start_index - Start from this character. -1 for end of the page. | 255 // start_index - Start from this character. -1 for end of the page. |
| 188 // Return Value: | 256 // Return Value: |
| 189 // A handle for the search context. FPDFText_FindClose must be called t
o release this handle. | 257 // A handle for the search context. FPDFText_FindClose must be called |
| 190 // | 258 // to release this handle. |
| 191 DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, FPD
F_WIDESTRING findwhat, | 259 // |
| 192 unsigned long flags, int sta
rt_index); | 260 DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, |
| 261 FPDF_WIDESTRING findwhat, |
| 262 unsigned long flags, |
| 263 int start_index); |
| 193 | 264 |
| 194 // Function: FPDFText_FindNext | 265 // Function: FPDFText_FindNext |
| 195 // Search in the direction from page start to end. | 266 // Search in the direction from page start to end. |
| 196 // Parameters: | 267 // Parameters: |
| 197 // handle - A search context handle returned by FPDFText_FindSta
rt. | 268 // handle - A search context handle returned by |
| 269 // FPDFText_FindStart. |
| 198 // Return Value: | 270 // Return Value: |
| 199 // Whether a match is found. | 271 // Whether a match is found. |
| 200 // | 272 // |
| 201 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle); | 273 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle); |
| 202 | 274 |
| 203 // Function: FPDFText_FindPrev | 275 // Function: FPDFText_FindPrev |
| 204 // Search in the direction from page end to start. | 276 // Search in the direction from page end to start. |
| 205 // Parameters: | 277 // Parameters: |
| 206 // handle - A search context handle returned by FPDFText_FindSta
rt. | 278 // handle - A search context handle returned by |
| 279 // FPDFText_FindStart. |
| 207 // Return Value: | 280 // Return Value: |
| 208 // Whether a match is found. | 281 // Whether a match is found. |
| 209 // | 282 // |
| 210 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle); | 283 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle); |
| 211 | 284 |
| 212 // Function: FPDFText_GetSchResultIndex | 285 // Function: FPDFText_GetSchResultIndex |
| 213 // Get the starting character index of the search result. | 286 // Get the starting character index of the search result. |
| 214 // Parameters: | 287 // Parameters: |
| 215 // handle - A search context handle returned by FPDFText_FindSta
rt. | 288 // handle - A search context handle returned by |
| 289 // FPDFText_FindStart. |
| 216 // Return Value: | 290 // Return Value: |
| 217 // Index for the starting character. | 291 // Index for the starting character. |
| 218 // | 292 // |
| 219 DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle); | 293 DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle); |
| 220 | 294 |
| 221 // Function: FPDFText_GetSchCount | 295 // Function: FPDFText_GetSchCount |
| 222 // Get the number of matched characters in the search result. | 296 // Get the number of matched characters in the search result. |
| 223 // Parameters: | 297 // Parameters: |
| 224 // handle - A search context handle returned by FPDFText_FindSta
rt. | 298 // handle - A search context handle returned by |
| 299 // FPDFText_FindStart. |
| 225 // Return Value: | 300 // Return Value: |
| 226 // Number of matched characters. | 301 // Number of matched characters. |
| 227 // | 302 // |
| 228 DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle); | 303 DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle); |
| 229 | 304 |
| 230 // Function: FPDFText_FindClose | 305 // Function: FPDFText_FindClose |
| 231 // Release a search context. | 306 // Release a search context. |
| 232 // Parameters: | 307 // Parameters: |
| 233 // handle - A search context handle returned by FPDFText_FindSta
rt. | 308 // handle - A search context handle returned by |
| 309 // FPDFText_FindStart. |
| 234 // Return Value: | 310 // Return Value: |
| 235 // None. | 311 // None. |
| 236 // | 312 // |
| 237 DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle); | 313 DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle); |
| 238 | 314 |
| 239 // Function: FPDFLink_LoadWebLinks | 315 // Function: FPDFLink_LoadWebLinks |
| 240 // Prepare information about weblinks in a page. | 316 // Prepare information about weblinks in a page. |
| 241 // Parameters: | 317 // Parameters: |
| 242 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. | 318 // text_page - Handle to a text page information structure. |
| 319 // Returned by FPDFText_LoadPage function. |
| 243 // Return Value: | 320 // Return Value: |
| 244 // A handle to the page's links information structure. | 321 // A handle to the page's links information structure. |
| 245 // NULL if something goes wrong. | 322 // NULL if something goes wrong. |
| 246 // Comments: | 323 // Comments: |
| 247 // Weblinks are those links implicitly embedded in PDF pages. PDF also
has a type of | 324 // Weblinks are those links implicitly embedded in PDF pages. PDF also |
| 248 // annotation called "link", FPDFTEXT doesn't deal with that kind of li
nk. | 325 // has a type of |
| 249 // FPDFTEXT weblink feature is useful for automatically detecting links
in the page | 326 // annotation called "link", FPDFTEXT doesn't deal with that kind of |
| 250 // contents. For example, things like "http://www.foxitsoftware.com" wi
ll be detected, | 327 // link. |
| 251 // so applications can allow user to click on those characters to activ
ate the link, | 328 // FPDFTEXT weblink feature is useful for automatically detecting links |
| 329 // in the page |
| 330 // contents. For example, things like "http://www.foxitsoftware.com" |
| 331 // will be detected, |
| 332 // so applications can allow user to click on those characters to |
| 333 // activate the link, |
| 252 // even the PDF doesn't come with link annotations. | 334 // even the PDF doesn't come with link annotations. |
| 253 // | 335 // |
| 254 // FPDFLink_CloseWebLinks must be called to release resources. | 336 // FPDFLink_CloseWebLinks must be called to release resources. |
| 255 // | 337 // |
| 256 DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page); | 338 DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page); |
| 257 | 339 |
| 258 // Function: FPDFLink_CountWebLinks | 340 // Function: FPDFLink_CountWebLinks |
| 259 // Count number of detected web links. | 341 // Count number of detected web links. |
| 260 // Parameters: | 342 // Parameters: |
| 261 // link_page - Handle returned by FPDFLink_LoadWebLinks. | 343 // link_page - Handle returned by FPDFLink_LoadWebLinks. |
| 262 // Return Value: | 344 // Return Value: |
| 263 // Number of detected web links. | 345 // Number of detected web links. |
| 264 // | 346 // |
| 265 DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page); | 347 DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page); |
| 266 | 348 |
| 267 // Function: FPDFLink_GetURL | 349 // Function: FPDFLink_GetURL |
| 268 // Fetch the URL information for a detected web link. | 350 // Fetch the URL information for a detected web link. |
| 269 // Parameters: | 351 // Parameters: |
| 270 // link_page - Handle returned by FPDFLink_LoadWebLinks. | 352 // link_page - Handle returned by FPDFLink_LoadWebLinks. |
| 271 // link_index - Zero-based index for the link. | 353 // link_index - Zero-based index for the link. |
| 272 // buffer - A unicode buffer. | 354 // buffer - A unicode buffer. |
| 273 // buflen - Number of characters (not bytes) for the buffer, inc
luding an additional terminator. | 355 // buflen - Number of characters (not bytes) for the buffer, |
| 356 // including an additional terminator. |
| 274 // Return Value: | 357 // Return Value: |
| 275 // If buffer is NULL or buflen is zero, return number of characters (no
t bytes and an additional terminator is also counted) needed, | 358 // If buffer is NULL or buflen is zero, return number of characters |
| 359 // (not bytes and an additional terminator is also counted) needed, |
| 276 // otherwise, return number of characters copied into the buffer. | 360 // otherwise, return number of characters copied into the buffer. |
| 277 // | 361 // |
| 278 DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, int link_index, u
nsigned short* buffer,int buflen); | 362 DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, |
| 363 int link_index, |
| 364 unsigned short* buffer, |
| 365 int buflen); |
| 279 | 366 |
| 280 // Function: FPDFLink_CountRects | 367 // Function: FPDFLink_CountRects |
| 281 // Count number of rectangular areas for the link. | 368 // Count number of rectangular areas for the link. |
| 282 // Parameters: | 369 // Parameters: |
| 283 // link_page - Handle returned by FPDFLink_LoadWebLinks. | 370 // link_page - Handle returned by FPDFLink_LoadWebLinks. |
| 284 // link_index - Zero-based index for the link. | 371 // link_index - Zero-based index for the link. |
| 285 // Return Value: | 372 // Return Value: |
| 286 // Number of rectangular areas for the link. | 373 // Number of rectangular areas for the link. |
| 287 // | 374 // |
| 288 DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, int link_inde
x); | 375 DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, |
| 376 int link_index); |
| 289 | 377 |
| 290 // Function: FPDFLink_GetRect | 378 // Function: FPDFLink_GetRect |
| 291 // Fetch the boundaries of a rectangle for a link. | 379 // Fetch the boundaries of a rectangle for a link. |
| 292 // Parameters: | 380 // Parameters: |
| 293 // link_page - Handle returned by FPDFLink_LoadWebLinks. | 381 // link_page - Handle returned by FPDFLink_LoadWebLinks. |
| 294 // link_index - Zero-based index for the link. | 382 // link_index - Zero-based index for the link. |
| 295 // rect_index - Zero-based index for a rectangle. | 383 // rect_index - Zero-based index for a rectangle. |
| 296 // left - Pointer to a double value receiving the rectangle le
ft boundary. | 384 // left - Pointer to a double value receiving the rectangle |
| 297 // top - Pointer to a double value receiving the rectangle to
p boundary. | 385 // left boundary. |
| 298 // right - Pointer to a double value receiving the rectangle ri
ght boundary. | 386 // top - Pointer to a double value receiving the rectangle |
| 299 // bottom - Pointer to a double value receiving the rectangle bo
ttom boundary. | 387 // top boundary. |
| 388 // right - Pointer to a double value receiving the rectangle |
| 389 // right boundary. |
| 390 // bottom - Pointer to a double value receiving the rectangle |
| 391 // bottom boundary. |
| 300 // Return Value: | 392 // Return Value: |
| 301 // None. | 393 // None. |
| 302 // | 394 // |
| 303 DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, int link_index,
int rect_index, | 395 DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, |
| 304 double* left, double* top,double* right,
double* bottom); | 396 int link_index, |
| 397 int rect_index, |
| 398 double* left, |
| 399 double* top, |
| 400 double* right, |
| 401 double* bottom); |
| 305 | 402 |
| 306 // Function: FPDFLink_CloseWebLinks | 403 // Function: FPDFLink_CloseWebLinks |
| 307 // Release resources used by weblink feature. | 404 // Release resources used by weblink feature. |
| 308 // Parameters: | 405 // Parameters: |
| 309 // link_page - Handle returned by FPDFLink_LoadWebLinks. | 406 // link_page - Handle returned by FPDFLink_LoadWebLinks. |
| 310 // Return Value: | 407 // Return Value: |
| 311 // None. | 408 // None. |
| 312 // | 409 // |
| 313 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page); | 410 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page); |
| 314 | 411 |
| 315 | |
| 316 #ifdef __cplusplus | 412 #ifdef __cplusplus |
| 317 } | 413 } |
| 318 #endif | 414 #endif |
| 319 | 415 |
| 320 #endif // PUBLIC_FPDF_TEXT_H_ | 416 #endif // PUBLIC_FPDF_TEXT_H_ |
| OLD | NEW |