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