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 _FPDFTEXT_H_ | 7 #ifndef PUBLIC_FPDF_TEXT_H_ |
8 #define _FPDFTEXT_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_Loa
dPage function (in FPDFVIEW module). | 20 // page - Handle to the page. Returned by FPDF_LoadPage function (
in FPDFVIEW module). |
21 // Return value: | 21 // Return value: |
22 //» » » A handle to the text page information structure. | 22 // A handle to the text page information structure. |
23 //» » » NULL if something goes wrong. | 23 // NULL if something goes wrong. |
24 // Comments: | 24 // Comments: |
25 //» » » Application must call FPDFText_ClosePage to release the
text page information. | 25 // Application must call FPDFText_ClosePage to release the text page in
formation. |
26 // | 26 // |
27 DLLEXPORT FPDF_TEXTPAGE»STDCALL FPDFText_LoadPage(FPDF_PAGE page); | 27 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page); |
28 | 28 |
29 // Function: FPDFText_ClosePage | 29 // Function: FPDFText_ClosePage |
30 //» » » Release all resources allocated for a text page informat
ion structure. | 30 // Release all resources allocated for a text page information structur
e. |
31 // Parameters: | 31 // Parameters: |
32 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 32 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
33 // Return Value: | 33 // Return Value: |
34 //» » » None. | 34 // None. |
35 // | 35 // |
36 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page); | 36 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page); |
37 | 37 |
38 // Function: FPDFText_CountChars | 38 // Function: FPDFText_CountChars |
39 //» » » Get number of characters in a page. | 39 // Get number of characters in a page. |
40 // Parameters: | 40 // Parameters: |
41 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 41 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
42 // Return value: | 42 // Return value: |
43 //» » » Number of characters in the page. Return -1 for error. | 43 // Number of characters in the page. Return -1 for error. |
44 //» » » Generated characters, like additional space characters,
new line characters, are also counted. | 44 // Generated characters, like additional space characters, new line cha
racters, are also counted. |
45 // Comments: | 45 // Comments: |
46 //» » » Characters in a page form a "stream", inside the stream,
each character has an index. | 46 // Characters in a page form a "stream", inside the stream, each charac
ter has an index. |
47 //» » » We will use the index parameters in many of FPDFTEXT fun
ctions. The first character in the page | 47 // We will use the index parameters in many of FPDFTEXT functions. The
first character in the page |
48 //» » » has an index value of zero. | 48 // has an index value of zero. |
49 // | 49 // |
50 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page); | 50 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page); |
51 | 51 |
52 // Function: FPDFText_GetUnicode | 52 // Function: FPDFText_GetUnicode |
53 //» » » Get Unicode of a character in a page. | 53 // Get Unicode of a character in a page. |
54 // Parameters: | 54 // Parameters: |
55 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 55 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
56 //» » » index» » -» Zero-based index of the characte
r. | 56 // index - Zero-based index of the character. |
57 // Return value: | 57 // Return value: |
58 //» » » The Unicode of the particular character. | 58 // The Unicode of the particular character. |
59 //» » » If a character is not encoded in Unicode and Foxit engin
e can't convert to Unicode, | 59 // If a character is not encoded in Unicode and Foxit engine can't conv
ert to Unicode, |
60 //» » » the return value will be zero. | 60 // the return value will be zero. |
61 // | 61 // |
62 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int
index); | 62 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int
index); |
63 | 63 |
64 // Function: FPDFText_GetFontSize | 64 // Function: FPDFText_GetFontSize |
65 //» » » Get the font size of a particular character. | 65 // Get the font size of a particular character. |
66 // Parameters: | 66 // Parameters: |
67 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 67 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
68 //» » » index» » -» Zero-based index of the characte
r. | 68 // index - Zero-based index of the character. |
69 // Return value: | 69 // Return value: |
70 //» » » The font size of the particular character, measured in p
oints (about 1/72 inch). | 70 // The font size of the particular character, measured in points (about
1/72 inch). |
71 //» » » This is the typographic size of the font (so called "em
size"). | 71 // This is the typographic size of the font (so called "em size"). |
72 // | 72 // |
73 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, int index
); | 73 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, int index
); |
74 | 74 |
75 // Function: FPDFText_GetCharBox | 75 // Function: FPDFText_GetCharBox |
76 //» » » Get bounding box of a particular character. | 76 // Get bounding box of a particular character. |
77 // Parameters: | 77 // Parameters: |
78 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 78 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
79 //» » » index» » -» Zero-based index of the characte
r. | 79 // index - Zero-based index of the character. |
80 //» » » left» » -» Pointer to a double number recei
ving left position of the character box. | 80 // left - Pointer to a double number receiving left position o
f the character box. |
81 //» » » right» » -» Pointer to a double number recei
ving right position of the character box. | 81 // right - Pointer to a double number receiving right position
of the character box. |
82 //» » » bottom» » -» Pointer to a double number recei
ving bottom position of the character box. | 82 // bottom - Pointer to a double number receiving bottom position
of the character box. |
83 //» » » top» » » -» Pointer to a double numb
er receiving top position of the character box. | 83 // top - Pointer to a double number receiving top position of
the character box. |
84 // Return Value: | 84 // Return Value: |
85 //» » » None. | 85 // None. |
86 // Comments: | 86 // Comments: |
87 //» » » All positions are measured in PDF "user space". | 87 // All positions are measured in PDF "user space". |
88 // | 88 // |
89 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, int index, d
ouble* left, | 89 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, int index, d
ouble* left, |
90 » » » » » » » » » »
» » » double* right, double* bottom, double* top); | 90 double* right, double* botto
m, double* top); |
91 | 91 |
92 // Function: FPDFText_GetCharIndexAtPos | 92 // Function: FPDFText_GetCharIndexAtPos |
93 //» » » Get the index of a character at or nearby a certain posi
tion on the page. | 93 // Get the index of a character at or nearby a certain position on the
page. |
94 // Parameters: | 94 // Parameters: |
95 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 95 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
96 //» » » x» » » -» X position in PDF "user
space". | 96 // x - X position in PDF "user space". |
97 //» » » y» » » -» Y position in PDF "user
space". | 97 // y - Y position in PDF "user space". |
98 //» » » xTolerance» -» An x-axis tolerance value for ch
aracter hit detection, in point unit. | 98 // xTolerance - An x-axis tolerance value for character hit detectio
n, in point unit. |
99 //» » » yTolerance» -» A y-axis tolerance value for cha
racter hit detection, in point unit. | 99 // yTolerance - A y-axis tolerance value for character hit detection
, in point unit. |
100 // Return Value: | 100 // Return Value: |
101 //» » » The zero-based index of the character at, or nearby the
point (x,y). | 101 // 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 be -1. | 102 // If there is no character at or nearby the point, return value will b
e -1. |
103 //» » » If an error occurs, -3 will be returned. | 103 // If an error occurs, -3 will be returned. |
104 // | 104 // |
105 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, | 105 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, |
106 » » » » » » » » » »
» » double x, double y, double xTorelance, double yTolerance); | 106 double x, double y, double xTor
elance, double yTolerance); |
107 | 107 |
108 // Function: FPDFText_GetText | 108 // Function: FPDFText_GetText |
109 //» » » Extract unicode text string from the page. | 109 // Extract unicode text string from the page. |
110 // Parameters: | 110 // Parameters: |
111 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 111 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
112 //» » » start_index» -» Index for the start characters. | 112 // start_index - Index for the start characters. |
113 //» » » count» » -» Number of characters to be extra
cted. | 113 // count - Number of characters to be extracted. |
114 //» » » result» » -» A buffer (allocated by applicati
on) receiving the extracted unicodes. | 114 // result - A buffer (allocated by application) receiving the ex
tracted unicodes. |
115 //» » » » » » » The size of the buffer m
ust be able to hold the number of characters plus a terminator. | 115 // The size of the buffer must be able to hold the numb
er of characters plus a terminator. |
116 // Return Value: | 116 // Return Value: |
117 //» » » Number of characters written into the result buffer, inc
luding the trailing terminator. | 117 // Number of characters written into the result buffer, including the t
railing terminator. |
118 // Comments: | 118 // Comments: |
119 //» » » This function ignores characters without unicode informa
tion. | 119 // This function ignores characters without unicode information. |
120 // | 120 // |
121 DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, int start_index,
int count, unsigned short* result); | 121 DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, int start_index,
int count, unsigned short* result); |
122 | 122 |
123 // Function: FPDFText_CountRects | 123 // Function: FPDFText_CountRects |
124 //» » » Count number of rectangular areas occupied by a segment
of texts. | 124 // Count number of rectangular areas occupied by a segment of texts. |
125 // Parameters: | 125 // Parameters: |
126 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 126 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
127 //» » » start_index» -» Index for the start characters. | 127 // start_index - Index for the start characters. |
128 //» » » count» » -» Number of characters. | 128 // count - Number of characters. |
129 // Return value: | 129 // Return value: |
130 //» » » Number of rectangles. Zero for error. | 130 // Number of rectangles. Zero for error. |
131 // Comments: | 131 // Comments: |
132 //» » » This function, along with FPDFText_GetRect can be used b
y applications to detect the position | 132 // This function, along with FPDFText_GetRect can be used by applicatio
ns to detect the position |
133 //» » » on the page for a text segment, so proper areas can be h
ighlighted or something. | 133 // on the page for a text segment, so proper areas can be highlighted o
r something. |
134 //» » » FPDFTEXT will automatically merge small character boxes
into bigger one if those characters | 134 // FPDFTEXT will automatically merge small character boxes into bigger
one if those characters |
135 //» » » are on the same line and use same font settings. | 135 // are on the same line and use same font settings. |
136 // | 136 // |
137 DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, int start_ind
ex, int count); | 137 DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, int start_ind
ex, int count); |
138 | 138 |
139 // Function: FPDFText_GetRect | 139 // Function: FPDFText_GetRect |
140 //» » » Get a rectangular area from the result generated by FPDF
Text_CountRects. | 140 // Get a rectangular area from the result generated by FPDFText_CountRe
cts. |
141 // Parameters: | 141 // Parameters: |
142 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 142 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
143 //» » » rect_index» -» Zero-based index for the rectang
le. | 143 // rect_index - Zero-based index for the rectangle. |
144 //» » » left» » -» Pointer to a double value receiv
ing the rectangle left boundary. | 144 // left - Pointer to a double value receiving the rectangle le
ft boundary. |
145 //» » » top» » » -» Pointer to a double valu
e receiving the rectangle top boundary. | 145 // top - Pointer to a double value receiving the rectangle to
p boundary. |
146 //» » » right» » -» Pointer to a double value receiv
ing the rectangle right boundary. | 146 // right - Pointer to a double value receiving the rectangle ri
ght boundary. |
147 //» » » bottom» » -» Pointer to a double value receiv
ing the rectangle bottom boundary. | 147 // bottom - Pointer to a double value receiving the rectangle bo
ttom boundary. |
148 // Return Value: | 148 // Return Value: |
149 //» » » None. | 149 // None. |
150 // | 150 // |
151 DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, int rect_index,
double* left, double* top, | 151 DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, int rect_index,
double* left, double* top, |
152 » » » » » » » » » »
» double* right, double* bottom); | 152 double* right, double* bottom); |
153 | 153 |
154 // Function: FPDFText_GetBoundedText | 154 // Function: FPDFText_GetBoundedText |
155 //» » » Extract unicode text within a rectangular boundary on th
e page. | 155 // Extract unicode text within a rectangular boundary on the page. |
156 // Parameters: | 156 // Parameters: |
157 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 157 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
158 //» » » left» » -» Left boundary. | 158 // left - Left boundary. |
159 //» » » top» » » -» Top boundary. | 159 // top - Top boundary. |
160 //» » » right» » -» Right boundary. | 160 // right - Right boundary. |
161 //» » » bottom» » -» Bottom boundary. | 161 // bottom - Bottom boundary. |
162 //» » » buffer» » -» A unicode buffer. | 162 // buffer - A unicode buffer. |
163 //» » » buflen» » -» Number of characters (not bytes)
for the buffer, excluding an additional terminator. | 163 // buflen - Number of characters (not bytes) for the buffer, exc
luding an additional terminator. |
164 // Return Value: | 164 // Return Value: |
165 //» » » If buffer is NULL or buflen is zero, return number of ch
aracters (not bytes) of text present within | 165 // If buffer is NULL or buflen is zero, return number of characters (no
t bytes) of text present within |
166 //» » » the rectangle, excluding a terminating NUL. Generally y
ou should pass a buffer at least one larger | 166 // the rectangle, excluding a terminating NUL. Generally you should pa
ss a buffer at least one larger |
167 //» » » than this if you want a terminating NUL, which will be p
rovided if space is available. | 167 // than this if you want a terminating NUL, which will be provided if s
pace is available. |
168 //» » » Otherwise, return number of characters copied into the b
uffer, including the terminating NUL | 168 // Otherwise, return number of characters copied into the buffer, inclu
ding the terminating NUL |
169 //» » » when space for it is available. | 169 // when space for it is available. |
170 // Comment: | 170 // Comment: |
171 //» » » If the buffer is too small, as much text as will fit is
copied into it. | 171 // If the buffer is too small, as much text as will fit is copied into
it. |
172 // | 172 // |
173 DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double lef
t, double top, | 173 DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double lef
t, double top, |
174 » » » » » » » » » »
» double right, double bottom,unsigned short* buffer,int buflen); | 174 double right, double bottom,unsign
ed short* buffer,int buflen); |
175 | 175 |
176 | 176 |
177 // Flags used by FPDFText_FindStart function. | 177 // Flags used by FPDFText_FindStart function. |
178 #define FPDF_MATCHCASE 0x00000001» » //If not set, it will not match
case by default. | 178 #define FPDF_MATCHCASE 0x00000001 //If not set, it will not match case
by default. |
179 #define FPDF_MATCHWHOLEWORD 0x00000002» » //If not set, it will not match
the whole word by default. | 179 #define FPDF_MATCHWHOLEWORD 0x00000002 //If not set, it will not match the
whole word by default. |
180 | 180 |
181 // Function: FPDFText_FindStart | 181 // Function: FPDFText_FindStart |
182 //» » » Start a search. | 182 // Start a search. |
183 // Parameters: | 183 // Parameters: |
184 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 184 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
185 //» » » findwhat» -» A unicode match pattern. | 185 // findwhat - A unicode match pattern. |
186 //» » » flags» » -» Option flags. | 186 // flags - Option flags. |
187 //» » » start_index» -» Start from this character. -1 fo
r end of the page. | 187 // start_index - Start from this character. -1 for end of the page. |
188 // Return Value: | 188 // Return Value: |
189 //» » » A handle for the search context. FPDFText_FindClose must
be called to release this handle. | 189 // A handle for the search context. FPDFText_FindClose must be called t
o release this handle. |
190 // | 190 // |
191 DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, FPD
F_WIDESTRING findwhat, | 191 DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, FPD
F_WIDESTRING findwhat, |
192 » » » » » » » » » »
» » » unsigned long flags, int start_index); | 192 unsigned long flags, int sta
rt_index); |
193 | 193 |
194 // Function: FPDFText_FindNext | 194 // Function: FPDFText_FindNext |
195 //» » » Search in the direction from page start to end. | 195 // Search in the direction from page start to end. |
196 // Parameters: | 196 // Parameters: |
197 //» » » handle» » -» A search context handle returned
by FPDFText_FindStart. | 197 // handle - A search context handle returned by FPDFText_FindSta
rt. |
198 // Return Value: | 198 // Return Value: |
199 //» » » Whether a match is found. | 199 // Whether a match is found. |
200 // | 200 // |
201 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle); | 201 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle); |
202 | 202 |
203 // Function: FPDFText_FindPrev | 203 // Function: FPDFText_FindPrev |
204 //» » » Search in the direction from page end to start. | 204 // Search in the direction from page end to start. |
205 // Parameters: | 205 // Parameters: |
206 //» » » handle» » -» A search context handle returned
by FPDFText_FindStart. | 206 // handle - A search context handle returned by FPDFText_FindSta
rt. |
207 // Return Value: | 207 // Return Value: |
208 //» » » Whether a match is found. | 208 // Whether a match is found. |
209 // | 209 // |
210 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle); | 210 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle); |
211 | 211 |
212 // Function: FPDFText_GetSchResultIndex | 212 // Function: FPDFText_GetSchResultIndex |
213 //» » » Get the starting character index of the search result. | 213 // Get the starting character index of the search result. |
214 // Parameters: | 214 // Parameters: |
215 //» » » handle» » -» A search context handle returned
by FPDFText_FindStart. | 215 // handle - A search context handle returned by FPDFText_FindSta
rt. |
216 // Return Value: | 216 // Return Value: |
217 //» » » Index for the starting character. | 217 // Index for the starting character. |
218 // | 218 // |
219 DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle); | 219 DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle); |
220 | 220 |
221 // Function: FPDFText_GetSchCount | 221 // Function: FPDFText_GetSchCount |
222 //» » » Get the number of matched characters in the search resul
t. | 222 // Get the number of matched characters in the search result. |
223 // Parameters: | 223 // Parameters: |
224 //» » » handle» » -» A search context handle returned
by FPDFText_FindStart. | 224 // handle - A search context handle returned by FPDFText_FindSta
rt. |
225 // Return Value: | 225 // Return Value: |
226 //» » » Number of matched characters. | 226 // Number of matched characters. |
227 // | 227 // |
228 DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle); | 228 DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle); |
229 | 229 |
230 // Function: FPDFText_FindClose | 230 // Function: FPDFText_FindClose |
231 //» » » Release a search context. | 231 // Release a search context. |
232 // Parameters: | 232 // Parameters: |
233 //» » » handle» » -» A search context handle returned
by FPDFText_FindStart. | 233 // handle - A search context handle returned by FPDFText_FindSta
rt. |
234 // Return Value: | 234 // Return Value: |
235 //» » » None. | 235 // None. |
236 // | 236 // |
237 DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle); | 237 DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle); |
238 | 238 |
239 // Function: FPDFLink_LoadWebLinks | 239 // Function: FPDFLink_LoadWebLinks |
240 //» » » Prepare information about weblinks in a page. | 240 // Prepare information about weblinks in a page. |
241 // Parameters: | 241 // Parameters: |
242 //» » » text_page» -» Handle to a text page informatio
n structure. Returned by FPDFText_LoadPage function. | 242 // text_page - Handle to a text page information structure. Returne
d by FPDFText_LoadPage function. |
243 // Return Value: | 243 // Return Value: |
244 //» » » A handle to the page's links information structure. | 244 // A handle to the page's links information structure. |
245 //» » » NULL if something goes wrong. | 245 // NULL if something goes wrong. |
246 // Comments: | 246 // Comments: |
247 //» » » Weblinks are those links implicitly embedded in PDF page
s. PDF also has a type of | 247 // Weblinks are those links implicitly embedded in PDF pages. PDF also
has a type of |
248 //» » » annotation called "link", FPDFTEXT doesn't deal with tha
t kind of link. | 248 // annotation called "link", FPDFTEXT doesn't deal with that kind of li
nk. |
249 //» » » FPDFTEXT weblink feature is useful for automatically det
ecting links in the page | 249 // FPDFTEXT weblink feature is useful for automatically detecting links
in the page |
250 //» » » contents. For example, things like "http://www.foxitsoft
ware.com" will be detected, | 250 // contents. For example, things like "http://www.foxitsoftware.com" wi
ll be detected, |
251 //» » » so applications can allow user to click on those charact
ers to activate the link, | 251 // so applications can allow user to click on those characters to activ
ate the link, |
252 //» » » even the PDF doesn't come with link annotations. | 252 // even the PDF doesn't come with link annotations. |
253 // | 253 // |
254 //» » » FPDFLink_CloseWebLinks must be called to release resourc
es. | 254 // FPDFLink_CloseWebLinks must be called to release resources. |
255 // | 255 // |
256 DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page); | 256 DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page); |
257 | 257 |
258 // Function: FPDFLink_CountWebLinks | 258 // Function: FPDFLink_CountWebLinks |
259 //» » » Count number of detected web links. | 259 // Count number of detected web links. |
260 // Parameters: | 260 // Parameters: |
261 //» » » link_page» -» Handle returned by FPDFLink_Load
WebLinks. | 261 // link_page - Handle returned by FPDFLink_LoadWebLinks. |
262 // Return Value: | 262 // Return Value: |
263 //» » » Number of detected web links. | 263 // Number of detected web links. |
264 // | 264 // |
265 DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page); | 265 DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page); |
266 | 266 |
267 // Function: FPDFLink_GetURL | 267 // Function: FPDFLink_GetURL |
268 //» » » Fetch the URL information for a detected web link. | 268 // Fetch the URL information for a detected web link. |
269 // Parameters: | 269 // Parameters: |
270 //» » » link_page» -» Handle returned by FPDFLink_Load
WebLinks. | 270 // link_page - Handle returned by FPDFLink_LoadWebLinks. |
271 //» » » link_index» -» Zero-based index for the link. | 271 // link_index - Zero-based index for the link. |
272 //» » » buffer» » -» A unicode buffer. | 272 // buffer - A unicode buffer. |
273 //» » » buflen» » -» Number of characters (not bytes)
for the buffer, including an additional terminator. | 273 // buflen - Number of characters (not bytes) for the buffer, inc
luding an additional terminator. |
274 // Return Value: | 274 // Return Value: |
275 //» » » If buffer is NULL or buflen is zero, return number of ch
aracters (not bytes and an additional terminator is also counted) needed, | 275 // If buffer is NULL or buflen is zero, return number of characters (no
t bytes and an additional terminator is also counted) needed, |
276 //» » » otherwise, return number of characters copied into the b
uffer. | 276 // otherwise, return number of characters copied into the buffer. |
277 // | 277 // |
278 DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, int link_index, u
nsigned short* buffer,int buflen); | 278 DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, int link_index, u
nsigned short* buffer,int buflen); |
279 | 279 |
280 // Function: FPDFLink_CountRects | 280 // Function: FPDFLink_CountRects |
281 //» » » Count number of rectangular areas for the link. | 281 // Count number of rectangular areas for the link. |
282 // Parameters: | 282 // Parameters: |
283 //» » » link_page» -» Handle returned by FPDFLink_Load
WebLinks. | 283 // link_page - Handle returned by FPDFLink_LoadWebLinks. |
284 //» » » link_index» -» Zero-based index for the link. | 284 // link_index - Zero-based index for the link. |
285 // Return Value: | 285 // Return Value: |
286 //» » » Number of rectangular areas for the link. | 286 // Number of rectangular areas for the link. |
287 // | 287 // |
288 DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, int link_inde
x); | 288 DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, int link_inde
x); |
289 | 289 |
290 // Function: FPDFLink_GetRect | 290 // Function: FPDFLink_GetRect |
291 //» » » Fetch the boundaries of a rectangle for a link. | 291 // Fetch the boundaries of a rectangle for a link. |
292 // Parameters: | 292 // Parameters: |
293 //» » » link_page» -» Handle returned by FPDFLink_Load
WebLinks. | 293 // link_page - Handle returned by FPDFLink_LoadWebLinks. |
294 //» » » link_index» -» Zero-based index for the link. | 294 // link_index - Zero-based index for the link. |
295 //» » » rect_index» -» Zero-based index for a rectangle
. | 295 // rect_index - Zero-based index for a rectangle. |
296 //» » » left» » -» Pointer to a double value receiv
ing the rectangle left boundary. | 296 // left - Pointer to a double value receiving the rectangle le
ft boundary. |
297 //» » » top» » » -» Pointer to a double valu
e receiving the rectangle top boundary. | 297 // top - Pointer to a double value receiving the rectangle to
p boundary. |
298 //» » » right» » -» Pointer to a double value receiv
ing the rectangle right boundary. | 298 // right - Pointer to a double value receiving the rectangle ri
ght boundary. |
299 //» » » bottom» » -» Pointer to a double value receiv
ing the rectangle bottom boundary. | 299 // bottom - Pointer to a double value receiving the rectangle bo
ttom boundary. |
300 // Return Value: | 300 // Return Value: |
301 //» » » None. | 301 // None. |
302 // | 302 // |
303 DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, int link_index,
int rect_index, | 303 DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, int link_index,
int rect_index, |
304 » » » » » » » » » »
double* left, double* top,double* right, double* bottom); | 304 double* left, double* top,double* right,
double* bottom); |
305 | 305 |
306 // Function: FPDFLink_CloseWebLinks | 306 // Function: FPDFLink_CloseWebLinks |
307 //» » » Release resources used by weblink feature. | 307 // Release resources used by weblink feature. |
308 // Parameters: | 308 // Parameters: |
309 //» » » link_page» -» Handle returned by FPDFLink_Load
WebLinks. | 309 // link_page - Handle returned by FPDFLink_LoadWebLinks. |
310 // Return Value: | 310 // Return Value: |
311 //» » » None. | 311 // None. |
312 // | 312 // |
313 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page); | 313 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page); |
314 | 314 |
315 | 315 |
316 #ifdef __cplusplus | 316 #ifdef __cplusplus |
317 }; | 317 } |
318 #endif | 318 #endif |
319 | 319 |
320 #endif//_FPDFTEXT_H_ | 320 #endif // PUBLIC_FPDF_TEXT_H_ |
OLD | NEW |