1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef PUBLIC_FPDF_TEXT_H_
8 #define PUBLIC_FPDF_TEXT_H_
9 
10 // clang-format off
11 // NOLINTNEXTLINE(build/include)
12 #include "fpdfview.h"
13 
14 // Exported Functions
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 // Function: FPDFText_LoadPage
20 //          Prepare information about all characters in a page.
21 // Parameters:
22 //          page    -   Handle to the page. Returned by FPDF_LoadPage function
23 //                      (in FPDFVIEW module).
24 // Return value:
25 //          A handle to the text page information structure.
26 //          NULL if something goes wrong.
27 // Comments:
28 //          Application must call FPDFText_ClosePage to release the text page
29 //          information.
30 //
31 FPDF_EXPORT FPDF_TEXTPAGE FPDF_CALLCONV FPDFText_LoadPage(FPDF_PAGE page);
32 
33 // Function: FPDFText_ClosePage
34 //          Release all resources allocated for a text page information
35 //          structure.
36 // Parameters:
37 //          text_page   -   Handle to a text page information structure.
38 //                          Returned by FPDFText_LoadPage function.
39 // Return Value:
40 //          None.
41 //
42 FPDF_EXPORT void FPDF_CALLCONV FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
43 
44 // Function: FPDFText_CountChars
45 //          Get number of characters in a page.
46 // Parameters:
47 //          text_page   -   Handle to a text page information structure.
48 //                          Returned by FPDFText_LoadPage function.
49 // Return value:
50 //          Number of characters in the page. Return -1 for error.
51 //          Generated characters, like additional space characters, new line
52 //          characters, are also counted.
53 // Comments:
54 //          Characters in a page form a "stream", inside the stream, each
55 //          character has an index.
56 //          We will use the index parameters in many of FPDFTEXT functions. The
57 //          first character in the page
58 //          has an index value of zero.
59 //
60 FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountChars(FPDF_TEXTPAGE text_page);
61 
62 // Function: FPDFText_GetUnicode
63 //          Get Unicode of a character in a page.
64 // Parameters:
65 //          text_page   -   Handle to a text page information structure.
66 //                          Returned by FPDFText_LoadPage function.
67 //          index       -   Zero-based index of the character.
68 // Return value:
69 //          The Unicode of the particular character.
70 //          If a character is not encoded in Unicode and Foxit engine can't
71 //          convert to Unicode,
72 //          the return value will be zero.
73 //
74 FPDF_EXPORT unsigned int FPDF_CALLCONV
75 FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index);
76 
77 // Function: FPDFText_GetFontSize
78 //          Get the font size of a particular character.
79 // Parameters:
80 //          text_page   -   Handle to a text page information structure.
81 //                          Returned by FPDFText_LoadPage function.
82 //          index       -   Zero-based index of the character.
83 // Return value:
84 //          The font size of the particular character, measured in points (about
85 //          1/72 inch). This is the typographic size of the font (so called
86 //          "em size").
87 //
88 FPDF_EXPORT double FPDF_CALLCONV FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
89                                                       int index);
90 
91 // Experimental API.
92 // Function: FPDFText_GetFontInfo
93 //          Get the font name and flags of a particular character.
94 // Parameters:
95 //          text_page - Handle to a text page information structure.
96 //                      Returned by FPDFText_LoadPage function.
97 //          index     - Zero-based index of the character.
98 //          buffer    - A buffer receiving the font name.
99 //          buflen    - The length of |buffer| in bytes.
100 //          flags     - Optional pointer to an int receiving the font flags.
101 //                      These flags should be interpreted per PDF spec 1.7
102 //                      Section 5.7.1 Font Descriptor Flags.
103 // Return value:
104 //          On success, return the length of the font name, including the
105 //          trailing NUL character, in bytes. If this length is less than or
106 //          equal to |length|, |buffer| is set to the font name, |flags| is
107 //          set to the font flags. |buffer| is in UTF-8 encoding. Return 0 on
108 //          failure.
109 //
110 FPDF_EXPORT unsigned long FPDF_CALLCONV
111 FPDFText_GetFontInfo(FPDF_TEXTPAGE text_page,
112                      int index,
113                      void* buffer,
114                      unsigned long buflen,
115                      int* flags);
116 
117 // Experimental API.
118 // Function: FPDFText_GetFontWeight
119 //          Get the font weight of a particular character.
120 // Parameters:
121 //          text_page   -   Handle to a text page information structure.
122 //                          Returned by FPDFText_LoadPage function.
123 //          index       -   Zero-based index of the character.
124 // Return value:
125 //          On success, return the font weight of the particular character. If
126 //          |text_page| is invalid, if |index| is out of bounds, or if the
127 //          character's text object is undefined, return -1.
128 //
129 FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetFontWeight(FPDF_TEXTPAGE text_page,
130                                                      int index);
131 
132 // Experimental API.
133 // Function: FPDFText_GetTextRenderMode
134 //          Get text rendering mode of character.
135 // Parameters:
136 //          text_page   -   Handle to a text page information structure.
137 //                          Returned by FPDFText_LoadPage function.
138 //          index       -   Zero-based index of the character.
139 // Return Value:
140 //          On success, return the render mode value. A valid value is of type
141 //          FPDF_TEXT_RENDERMODE. If |text_page| is invalid, if |index| is out
142 //          of bounds, or if the text object is undefined, then return
143 //          FPDF_TEXTRENDERMODE_UNKNOWN.
144 //
145 FPDF_EXPORT FPDF_TEXT_RENDERMODE FPDF_CALLCONV
146 FPDFText_GetTextRenderMode(FPDF_TEXTPAGE text_page, int index);
147 
148 // Experimental API.
149 // Function: FPDFText_GetFillColor
150 //          Get the fill color of a particular character.
151 // Parameters:
152 //          text_page      -   Handle to a text page information structure.
153 //                             Returned by FPDFText_LoadPage function.
154 //          index          -   Zero-based index of the character.
155 //          R              -   Pointer to an unsigned int number receiving the
156 //                             red value of the fill color.
157 //          G              -   Pointer to an unsigned int number receiving the
158 //                             green value of the fill color.
159 //          B              -   Pointer to an unsigned int number receiving the
160 //                             blue value of the fill color.
161 //          A              -   Pointer to an unsigned int number receiving the
162 //                             alpha value of the fill color.
163 // Return value:
164 //          Whether the call succeeded. If false, |R|, |G|, |B| and |A| are
165 //          unchanged.
166 //
167 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
168 FPDFText_GetFillColor(FPDF_TEXTPAGE text_page,
169                       int index,
170                       unsigned int* R,
171                       unsigned int* G,
172                       unsigned int* B,
173                       unsigned int* A);
174 
175 // Experimental API.
176 // Function: FPDFText_GetStrokeColor
177 //          Get the stroke color of a particular character.
178 // Parameters:
179 //          text_page      -   Handle to a text page information structure.
180 //                             Returned by FPDFText_LoadPage function.
181 //          index          -   Zero-based index of the character.
182 //          R              -   Pointer to an unsigned int number receiving the
183 //                             red value of the stroke color.
184 //          G              -   Pointer to an unsigned int number receiving the
185 //                             green value of the stroke color.
186 //          B              -   Pointer to an unsigned int number receiving the
187 //                             blue value of the stroke color.
188 //          A              -   Pointer to an unsigned int number receiving the
189 //                             alpha value of the stroke color.
190 // Return value:
191 //          Whether the call succeeded. If false, |R|, |G|, |B| and |A| are
192 //          unchanged.
193 //
194 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
195 FPDFText_GetStrokeColor(FPDF_TEXTPAGE text_page,
196                         int index,
197                         unsigned int* R,
198                         unsigned int* G,
199                         unsigned int* B,
200                         unsigned int* A);
201 
202 // Experimental API.
203 // Function: FPDFText_GetCharAngle
204 //          Get character rotation angle.
205 // Parameters:
206 //          text_page   -   Handle to a text page information structure.
207 //                          Returned by FPDFText_LoadPage function.
208 //          index       -   Zero-based index of the character.
209 // Return Value:
210 //          On success, return the angle value in radian. Value will always be
211 //          greater or equal to 0. If |text_page| is invalid, or if |index| is
212 //          out of bounds, then return -1.
213 //
214 FPDF_EXPORT float FPDF_CALLCONV FPDFText_GetCharAngle(FPDF_TEXTPAGE text_page,
215                                                       int index);
216 
217 // Function: FPDFText_GetCharBox
218 //          Get bounding box of a particular character.
219 // Parameters:
220 //          text_page   -   Handle to a text page information structure.
221 //                          Returned by FPDFText_LoadPage function.
222 //          index       -   Zero-based index of the character.
223 //          left        -   Pointer to a double number receiving left position
224 //                          of the character box.
225 //          right       -   Pointer to a double number receiving right position
226 //                          of the character box.
227 //          bottom      -   Pointer to a double number receiving bottom position
228 //                          of the character box.
229 //          top         -   Pointer to a double number receiving top position of
230 //                          the character box.
231 // Return Value:
232 //          On success, return TRUE and fill in |left|, |right|, |bottom|, and
233 //          |top|. If |text_page| is invalid, or if |index| is out of bounds,
234 //          then return FALSE, and the out parameters remain unmodified.
235 // Comments:
236 //          All positions are measured in PDF "user space".
237 //
238 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
239                                                         int index,
240                                                         double* left,
241                                                         double* right,
242                                                         double* bottom,
243                                                         double* top);
244 
245 // Experimental API.
246 // Function: FPDFText_GetLooseCharBox
247 //          Get a "loose" bounding box of a particular character, i.e., covering
248 //          the entire glyph bounds, without taking the actual glyph shape into
249 //          account.
250 // Parameters:
251 //          text_page   -   Handle to a text page information structure.
252 //                          Returned by FPDFText_LoadPage function.
253 //          index       -   Zero-based index of the character.
254 //          rect        -   Pointer to a FS_RECTF receiving the character box.
255 // Return Value:
256 //          On success, return TRUE and fill in |rect|. If |text_page| is
257 //          invalid, or if |index| is out of bounds, then return FALSE, and the
258 //          |rect| out parameter remains unmodified.
259 // Comments:
260 //          All positions are measured in PDF "user space".
261 //
262 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
263 FPDFText_GetLooseCharBox(FPDF_TEXTPAGE text_page, int index, FS_RECTF* rect);
264 
265 // Experimental API.
266 // Function: FPDFText_GetMatrix
267 //          Get the effective transformation matrix for a particular character.
268 // Parameters:
269 //          text_page   -   Handle to a text page information structure.
270 //                          Returned by FPDFText_LoadPage().
271 //          index       -   Zero-based index of the character.
272 //          matrix      -   Pointer to a FS_MATRIX receiving the transformation
273 //                          matrix.
274 // Return Value:
275 //          On success, return TRUE and fill in |matrix|. If |text_page| is
276 //          invalid, or if |index| is out of bounds, or if |matrix| is NULL,
277 //          then return FALSE, and |matrix| remains unmodified.
278 //
279 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_TEXTPAGE text_page,
280                                                        int index,
281                                                        FS_MATRIX* matrix);
282 
283 // Function: FPDFText_GetCharOrigin
284 //          Get origin of a particular character.
285 // Parameters:
286 //          text_page   -   Handle to a text page information structure.
287 //                          Returned by FPDFText_LoadPage function.
288 //          index       -   Zero-based index of the character.
289 //          x           -   Pointer to a double number receiving x coordinate of
290 //                          the character origin.
291 //          y           -   Pointer to a double number receiving y coordinate of
292 //                          the character origin.
293 // Return Value:
294 //          Whether the call succeeded. If false, x and y are unchanged.
295 // Comments:
296 //          All positions are measured in PDF "user space".
297 //
298 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
299 FPDFText_GetCharOrigin(FPDF_TEXTPAGE text_page,
300                        int index,
301                        double* x,
302                        double* y);
303 
304 // Function: FPDFText_GetCharIndexAtPos
305 //          Get the index of a character at or nearby a certain position on the
306 //          page.
307 // Parameters:
308 //          text_page   -   Handle to a text page information structure.
309 //                          Returned by FPDFText_LoadPage function.
310 //          x           -   X position in PDF "user space".
311 //          y           -   Y position in PDF "user space".
312 //          xTolerance  -   An x-axis tolerance value for character hit
313 //                          detection, in point units.
314 //          yTolerance  -   A y-axis tolerance value for character hit
315 //                          detection, in point units.
316 // Return Value:
317 //          The zero-based index of the character at, or nearby the point (x,y).
318 //          If there is no character at or nearby the point, return value will
319 //          be -1. If an error occurs, -3 will be returned.
320 //
321 FPDF_EXPORT int FPDF_CALLCONV
322 FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
323                            double x,
324                            double y,
325                            double xTolerance,
326                            double yTolerance);
327 
328 // Function: FPDFText_GetText
329 //          Extract unicode text string from the page.
330 // Parameters:
331 //          text_page   -   Handle to a text page information structure.
332 //                          Returned by FPDFText_LoadPage function.
333 //          start_index -   Index for the start characters.
334 //          count       -   Number of characters to be extracted.
335 //          result      -   A buffer (allocated by application) receiving the
336 //                          extracted unicodes. The size of the buffer must be
337 //                          able to hold the number of characters plus a
338 //                          terminator.
339 // Return Value:
340 //          Number of characters written into the result buffer, including the
341 //          trailing terminator.
342 // Comments:
343 //          This function ignores characters without unicode information.
344 //
345 FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetText(FPDF_TEXTPAGE text_page,
346                                                int start_index,
347                                                int count,
348                                                unsigned short* result);
349 
350 // Function: FPDFText_CountRects
351 //          Count number of rectangular areas occupied by a segment of texts.
352 // Parameters:
353 //          text_page   -   Handle to a text page information structure.
354 //                          Returned by FPDFText_LoadPage function.
355 //          start_index -   Index for the start characters.
356 //          count       -   Number of characters.
357 // Return value:
358 //          Number of rectangles. Zero for error.
359 // Comments:
360 //          This function, along with FPDFText_GetRect can be used by
361 //          applications to detect the position on the page for a text segment,
362 //          so proper areas can be highlighted. FPDFTEXT will automatically
363 //          merge small character boxes into bigger one if those characters
364 //          are on the same line and use same font settings.
365 //
366 FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountRects(FPDF_TEXTPAGE text_page,
367                                                   int start_index,
368                                                   int count);
369 
370 // Function: FPDFText_GetRect
371 //          Get a rectangular area from the result generated by
372 //          FPDFText_CountRects.
373 // Parameters:
374 //          text_page   -   Handle to a text page information structure.
375 //                          Returned by FPDFText_LoadPage function.
376 //          rect_index  -   Zero-based index for the rectangle.
377 //          left        -   Pointer to a double value receiving the rectangle
378 //                          left boundary.
379 //          top         -   Pointer to a double value receiving the rectangle
380 //                          top boundary.
381 //          right       -   Pointer to a double value receiving the rectangle
382 //                          right boundary.
383 //          bottom      -   Pointer to a double value receiving the rectangle
384 //                          bottom boundary.
385 // Return Value:
386 //          On success, return TRUE and fill in |left|, |top|, |right|, and
387 //          |bottom|. If |text_page| is invalid then return FALSE, and the out
388 //          parameters remain unmodified. If |text_page| is valid but
389 //          |rect_index| is out of bounds, then return FALSE and set the out
390 //          parameters to 0.
391 //
392 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetRect(FPDF_TEXTPAGE text_page,
393                                                      int rect_index,
394                                                      double* left,
395                                                      double* top,
396                                                      double* right,
397                                                      double* bottom);
398 
399 // Function: FPDFText_GetBoundedText
400 //          Extract unicode text within a rectangular boundary on the page.
401 // Parameters:
402 //          text_page   -   Handle to a text page information structure.
403 //                          Returned by FPDFText_LoadPage function.
404 //          left        -   Left boundary.
405 //          top         -   Top boundary.
406 //          right       -   Right boundary.
407 //          bottom      -   Bottom boundary.
408 //          buffer      -   A unicode buffer.
409 //          buflen      -   Number of characters (not bytes) for the buffer,
410 //                          excluding an additional terminator.
411 // Return Value:
412 //          If buffer is NULL or buflen is zero, return number of characters
413 //          (not bytes) of text present within the rectangle, excluding a
414 //          terminating NUL. Generally you should pass a buffer at least one
415 //          larger than this if you want a terminating NUL, which will be
416 //          provided if space is available. Otherwise, return number of
417 //          characters copied into the buffer, including the terminating NUL
418 //          when space for it is available.
419 // Comment:
420 //          If the buffer is too small, as much text as will fit is copied into
421 //          it.
422 //
423 FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
424                                                       double left,
425                                                       double top,
426                                                       double right,
427                                                       double bottom,
428                                                       unsigned short* buffer,
429                                                       int buflen);
430 
431 // Flags used by FPDFText_FindStart function.
432 //
433 // If not set, it will not match case by default.
434 #define FPDF_MATCHCASE 0x00000001
435 // If not set, it will not match the whole word by default.
436 #define FPDF_MATCHWHOLEWORD 0x00000002
437 // If not set, it will skip past the current match to look for the next match.
438 #define FPDF_CONSECUTIVE 0x00000004
439 
440 // Function: FPDFText_FindStart
441 //          Start a search.
442 // Parameters:
443 //          text_page   -   Handle to a text page information structure.
444 //                          Returned by FPDFText_LoadPage function.
445 //          findwhat    -   A unicode match pattern.
446 //          flags       -   Option flags.
447 //          start_index -   Start from this character. -1 for end of the page.
448 // Return Value:
449 //          A handle for the search context. FPDFText_FindClose must be called
450 //          to release this handle.
451 //
452 FPDF_EXPORT FPDF_SCHHANDLE FPDF_CALLCONV
453 FPDFText_FindStart(FPDF_TEXTPAGE text_page,
454                    FPDF_WIDESTRING findwhat,
455                    unsigned long flags,
456                    int start_index);
457 
458 // Function: FPDFText_FindNext
459 //          Search in the direction from page start to end.
460 // Parameters:
461 //          handle      -   A search context handle returned by
462 //                          FPDFText_FindStart.
463 // Return Value:
464 //          Whether a match is found.
465 //
466 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_FindNext(FPDF_SCHHANDLE handle);
467 
468 // Function: FPDFText_FindPrev
469 //          Search in the direction from page end to start.
470 // Parameters:
471 //          handle      -   A search context handle returned by
472 //                          FPDFText_FindStart.
473 // Return Value:
474 //          Whether a match is found.
475 //
476 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_FindPrev(FPDF_SCHHANDLE handle);
477 
478 // Function: FPDFText_GetSchResultIndex
479 //          Get the starting character index of the search result.
480 // Parameters:
481 //          handle      -   A search context handle returned by
482 //                          FPDFText_FindStart.
483 // Return Value:
484 //          Index for the starting character.
485 //
486 FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
487 
488 // Function: FPDFText_GetSchCount
489 //          Get the number of matched characters in the search result.
490 // Parameters:
491 //          handle      -   A search context handle returned by
492 //                          FPDFText_FindStart.
493 // Return Value:
494 //          Number of matched characters.
495 //
496 FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
497 
498 // Function: FPDFText_FindClose
499 //          Release a search context.
500 // Parameters:
501 //          handle      -   A search context handle returned by
502 //                          FPDFText_FindStart.
503 // Return Value:
504 //          None.
505 //
506 FPDF_EXPORT void FPDF_CALLCONV FPDFText_FindClose(FPDF_SCHHANDLE handle);
507 
508 // Function: FPDFLink_LoadWebLinks
509 //          Prepare information about weblinks in a page.
510 // Parameters:
511 //          text_page   -   Handle to a text page information structure.
512 //                          Returned by FPDFText_LoadPage function.
513 // Return Value:
514 //          A handle to the page's links information structure, or
515 //          NULL if something goes wrong.
516 // Comments:
517 //          Weblinks are those links implicitly embedded in PDF pages. PDF also
518 //          has a type of annotation called "link" (FPDFTEXT doesn't deal with
519 //          that kind of link). FPDFTEXT weblink feature is useful for
520 //          automatically detecting links in the page contents. For example,
521 //          things like "https://www.example.com" will be detected, so
522 //          applications can allow user to click on those characters to activate
523 //          the link, even the PDF doesn't come with link annotations.
524 //
525 //          FPDFLink_CloseWebLinks must be called to release resources.
526 //
527 FPDF_EXPORT FPDF_PAGELINK FPDF_CALLCONV
528 FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
529 
530 // Function: FPDFLink_CountWebLinks
531 //          Count number of detected web links.
532 // Parameters:
533 //          link_page   -   Handle returned by FPDFLink_LoadWebLinks.
534 // Return Value:
535 //          Number of detected web links.
536 //
537 FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
538 
539 // Function: FPDFLink_GetURL
540 //          Fetch the URL information for a detected web link.
541 // Parameters:
542 //          link_page   -   Handle returned by FPDFLink_LoadWebLinks.
543 //          link_index  -   Zero-based index for the link.
544 //          buffer      -   A unicode buffer for the result.
545 //          buflen      -   Number of 16-bit code units (not bytes) for the
546 //                          buffer, including an additional terminator.
547 // Return Value:
548 //          If |buffer| is NULL or |buflen| is zero, return the number of 16-bit
549 //          code units (not bytes) needed to buffer the result (an additional
550 //          terminator is included in this count).
551 //          Otherwise, copy the result into |buffer|, truncating at |buflen| if
552 //          the result is too large to fit, and return the number of 16-bit code
553 //          units actually copied into the buffer (the additional terminator is
554 //          also included in this count).
555 //          If |link_index| does not correspond to a valid link, then the result
556 //          is an empty string.
557 //
558 FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetURL(FPDF_PAGELINK link_page,
559                                               int link_index,
560                                               unsigned short* buffer,
561                                               int buflen);
562 
563 // Function: FPDFLink_CountRects
564 //          Count number of rectangular areas for the link.
565 // Parameters:
566 //          link_page   -   Handle returned by FPDFLink_LoadWebLinks.
567 //          link_index  -   Zero-based index for the link.
568 // Return Value:
569 //          Number of rectangular areas for the link.  If |link_index| does
570 //          not correspond to a valid link, then 0 is returned.
571 //
572 FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountRects(FPDF_PAGELINK link_page,
573                                                   int link_index);
574 
575 // Function: FPDFLink_GetRect
576 //          Fetch the boundaries of a rectangle for a link.
577 // Parameters:
578 //          link_page   -   Handle returned by FPDFLink_LoadWebLinks.
579 //          link_index  -   Zero-based index for the link.
580 //          rect_index  -   Zero-based index for a rectangle.
581 //          left        -   Pointer to a double value receiving the rectangle
582 //                          left boundary.
583 //          top         -   Pointer to a double value receiving the rectangle
584 //                          top boundary.
585 //          right       -   Pointer to a double value receiving the rectangle
586 //                          right boundary.
587 //          bottom      -   Pointer to a double value receiving the rectangle
588 //                          bottom boundary.
589 // Return Value:
590 //          On success, return TRUE and fill in |left|, |top|, |right|, and
591 //          |bottom|. If |link_page| is invalid or if |link_index| does not
592 //          correspond to a valid link, then return FALSE, and the out
593 //          parameters remain unmodified.
594 //
595 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetRect(FPDF_PAGELINK link_page,
596                                                      int link_index,
597                                                      int rect_index,
598                                                      double* left,
599                                                      double* top,
600                                                      double* right,
601                                                      double* bottom);
602 
603 // Experimental API.
604 // Function: FPDFLink_GetTextRange
605 //          Fetch the start char index and char count for a link.
606 // Parameters:
607 //          link_page         -   Handle returned by FPDFLink_LoadWebLinks.
608 //          link_index        -   Zero-based index for the link.
609 //          start_char_index  -   pointer to int receiving the start char index
610 //          char_count        -   pointer to int receiving the char count
611 // Return Value:
612 //          On success, return TRUE and fill in |start_char_index| and
613 //          |char_count|. if |link_page| is invalid or if |link_index| does
614 //          not correspond to a valid link, then return FALSE and the out
615 //          parameters remain unmodified.
616 //
617 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
618 FPDFLink_GetTextRange(FPDF_PAGELINK link_page,
619                       int link_index,
620                       int* start_char_index,
621                       int* char_count);
622 
623 // Function: FPDFLink_CloseWebLinks
624 //          Release resources used by weblink feature.
625 // Parameters:
626 //          link_page   -   Handle returned by FPDFLink_LoadWebLinks.
627 // Return Value:
628 //          None.
629 //
630 FPDF_EXPORT void FPDF_CALLCONV FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
631 
632 #ifdef __cplusplus
633 }
634 #endif
635 
636 #endif  // PUBLIC_FPDF_TEXT_H_
637