1 // Copyright 2017 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 #ifndef PUBLIC_FPDF_ANNOT_H_ 6 #define PUBLIC_FPDF_ANNOT_H_ 7 8 #include <stddef.h> 9 10 // NOLINTNEXTLINE(build/include) 11 #include "fpdfview.h" 12 13 // NOLINTNEXTLINE(build/include) 14 #include "fpdf_doc.h" 15 // NOLINTNEXTLINE(build/include) 16 #include "fpdf_formfill.h" 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif // __cplusplus 21 22 #define FPDF_ANNOT_UNKNOWN 0 23 #define FPDF_ANNOT_TEXT 1 24 #define FPDF_ANNOT_LINK 2 25 #define FPDF_ANNOT_FREETEXT 3 26 #define FPDF_ANNOT_LINE 4 27 #define FPDF_ANNOT_SQUARE 5 28 #define FPDF_ANNOT_CIRCLE 6 29 #define FPDF_ANNOT_POLYGON 7 30 #define FPDF_ANNOT_POLYLINE 8 31 #define FPDF_ANNOT_HIGHLIGHT 9 32 #define FPDF_ANNOT_UNDERLINE 10 33 #define FPDF_ANNOT_SQUIGGLY 11 34 #define FPDF_ANNOT_STRIKEOUT 12 35 #define FPDF_ANNOT_STAMP 13 36 #define FPDF_ANNOT_CARET 14 37 #define FPDF_ANNOT_INK 15 38 #define FPDF_ANNOT_POPUP 16 39 #define FPDF_ANNOT_FILEATTACHMENT 17 40 #define FPDF_ANNOT_SOUND 18 41 #define FPDF_ANNOT_MOVIE 19 42 #define FPDF_ANNOT_WIDGET 20 43 #define FPDF_ANNOT_SCREEN 21 44 #define FPDF_ANNOT_PRINTERMARK 22 45 #define FPDF_ANNOT_TRAPNET 23 46 #define FPDF_ANNOT_WATERMARK 24 47 #define FPDF_ANNOT_THREED 25 48 #define FPDF_ANNOT_RICHMEDIA 26 49 #define FPDF_ANNOT_XFAWIDGET 27 50 51 // Refer to PDF Reference (6th edition) table 8.16 for all annotation flags. 52 #define FPDF_ANNOT_FLAG_NONE 0 53 #define FPDF_ANNOT_FLAG_INVISIBLE (1 << 0) 54 #define FPDF_ANNOT_FLAG_HIDDEN (1 << 1) 55 #define FPDF_ANNOT_FLAG_PRINT (1 << 2) 56 #define FPDF_ANNOT_FLAG_NOZOOM (1 << 3) 57 #define FPDF_ANNOT_FLAG_NOROTATE (1 << 4) 58 #define FPDF_ANNOT_FLAG_NOVIEW (1 << 5) 59 #define FPDF_ANNOT_FLAG_READONLY (1 << 6) 60 #define FPDF_ANNOT_FLAG_LOCKED (1 << 7) 61 #define FPDF_ANNOT_FLAG_TOGGLENOVIEW (1 << 8) 62 63 #define FPDF_ANNOT_APPEARANCEMODE_NORMAL 0 64 #define FPDF_ANNOT_APPEARANCEMODE_ROLLOVER 1 65 #define FPDF_ANNOT_APPEARANCEMODE_DOWN 2 66 #define FPDF_ANNOT_APPEARANCEMODE_COUNT 3 67 68 // Refer to PDF Reference version 1.7 table 8.70 for field flags common to all 69 // interactive form field types. 70 #define FPDF_FORMFLAG_NONE 0 71 #define FPDF_FORMFLAG_READONLY (1 << 0) 72 #define FPDF_FORMFLAG_REQUIRED (1 << 1) 73 #define FPDF_FORMFLAG_NOEXPORT (1 << 2) 74 75 // Refer to PDF Reference version 1.7 table 8.77 for field flags specific to 76 // interactive form text fields. 77 #define FPDF_FORMFLAG_TEXT_MULTILINE (1 << 12) 78 #define FPDF_FORMFLAG_TEXT_PASSWORD (1 << 13) 79 80 // Refer to PDF Reference version 1.7 table 8.79 for field flags specific to 81 // interactive form choice fields. 82 #define FPDF_FORMFLAG_CHOICE_COMBO (1 << 17) 83 #define FPDF_FORMFLAG_CHOICE_EDIT (1 << 18) 84 85 typedef enum FPDFANNOT_COLORTYPE { 86 FPDFANNOT_COLORTYPE_Color = 0, 87 FPDFANNOT_COLORTYPE_InteriorColor 88 } FPDFANNOT_COLORTYPE; 89 90 // Experimental API. 91 // Check if an annotation subtype is currently supported for creation. 92 // Currently supported subtypes: circle, highlight, ink, popup, square, 93 // squiggly, stamp, strikeout, text, and underline. 94 // 95 // subtype - the subtype to be checked. 96 // 97 // Returns true if this subtype supported. 98 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 99 FPDFAnnot_IsSupportedSubtype(FPDF_ANNOTATION_SUBTYPE subtype); 100 101 // Experimental API. 102 // Create an annotation in |page| of the subtype |subtype|. If the specified 103 // subtype is illegal or unsupported, then a new annotation will not be created. 104 // Must call FPDFPage_CloseAnnot() when the annotation returned by this 105 // function is no longer needed. 106 // 107 // page - handle to a page. 108 // subtype - the subtype of the new annotation. 109 // 110 // Returns a handle to the new annotation object, or NULL on failure. 111 FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV 112 FPDFPage_CreateAnnot(FPDF_PAGE page, FPDF_ANNOTATION_SUBTYPE subtype); 113 114 // Experimental API. 115 // Get the number of annotations in |page|. 116 // 117 // page - handle to a page. 118 // 119 // Returns the number of annotations in |page|. 120 FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetAnnotCount(FPDF_PAGE page); 121 122 // Experimental API. 123 // Get annotation in |page| at |index|. Must call FPDFPage_CloseAnnot() when the 124 // annotation returned by this function is no longer needed. 125 // 126 // page - handle to a page. 127 // index - the index of the annotation. 128 // 129 // Returns a handle to the annotation object, or NULL on failure. 130 FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV FPDFPage_GetAnnot(FPDF_PAGE page, 131 int index); 132 133 // Experimental API. 134 // Get the index of |annot| in |page|. This is the opposite of 135 // FPDFPage_GetAnnot(). 136 // 137 // page - handle to the page that the annotation is on. 138 // annot - handle to an annotation. 139 // 140 // Returns the index of |annot|, or -1 on failure. 141 FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetAnnotIndex(FPDF_PAGE page, 142 FPDF_ANNOTATION annot); 143 144 // Experimental API. 145 // Close an annotation. Must be called when the annotation returned by 146 // FPDFPage_CreateAnnot() or FPDFPage_GetAnnot() is no longer needed. This 147 // function does not remove the annotation from the document. 148 // 149 // annot - handle to an annotation. 150 FPDF_EXPORT void FPDF_CALLCONV FPDFPage_CloseAnnot(FPDF_ANNOTATION annot); 151 152 // Experimental API. 153 // Remove the annotation in |page| at |index|. 154 // 155 // page - handle to a page. 156 // index - the index of the annotation. 157 // 158 // Returns true if successful. 159 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_RemoveAnnot(FPDF_PAGE page, 160 int index); 161 162 // Experimental API. 163 // Get the subtype of an annotation. 164 // 165 // annot - handle to an annotation. 166 // 167 // Returns the annotation subtype. 168 FPDF_EXPORT FPDF_ANNOTATION_SUBTYPE FPDF_CALLCONV 169 FPDFAnnot_GetSubtype(FPDF_ANNOTATION annot); 170 171 // Experimental API. 172 // Check if an annotation subtype is currently supported for object extraction, 173 // update, and removal. 174 // Currently supported subtypes: ink and stamp. 175 // 176 // subtype - the subtype to be checked. 177 // 178 // Returns true if this subtype supported. 179 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 180 FPDFAnnot_IsObjectSupportedSubtype(FPDF_ANNOTATION_SUBTYPE subtype); 181 182 // Experimental API. 183 // Update |obj| in |annot|. |obj| must be in |annot| already and must have 184 // been retrieved by FPDFAnnot_GetObject(). Currently, only ink and stamp 185 // annotations are supported by this API. Also note that only path, image, and 186 // text objects have APIs for modification; see FPDFPath_*(), FPDFText_*(), and 187 // FPDFImageObj_*(). 188 // 189 // annot - handle to an annotation. 190 // obj - handle to the object that |annot| needs to update. 191 // 192 // Return true if successful. 193 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 194 FPDFAnnot_UpdateObject(FPDF_ANNOTATION annot, FPDF_PAGEOBJECT obj); 195 196 // Experimental API. 197 // Add |obj| to |annot|. |obj| must have been created by 198 // FPDFPageObj_CreateNew{Path|Rect}() or FPDFPageObj_New{Text|Image}Obj(), and 199 // will be owned by |annot|. Note that an |obj| cannot belong to more than one 200 // |annot|. Currently, only ink and stamp annotations are supported by this API. 201 // Also note that only path, image, and text objects have APIs for creation. 202 // 203 // annot - handle to an annotation. 204 // obj - handle to the object that is to be added to |annot|. 205 // 206 // Return true if successful. 207 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 208 FPDFAnnot_AppendObject(FPDF_ANNOTATION annot, FPDF_PAGEOBJECT obj); 209 210 // Experimental API. 211 // Get the total number of objects in |annot|, including path objects, text 212 // objects, external objects, image objects, and shading objects. 213 // 214 // annot - handle to an annotation. 215 // 216 // Returns the number of objects in |annot|. 217 FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetObjectCount(FPDF_ANNOTATION annot); 218 219 // Experimental API. 220 // Get the object in |annot| at |index|. 221 // 222 // annot - handle to an annotation. 223 // index - the index of the object. 224 // 225 // Return a handle to the object, or NULL on failure. 226 FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV 227 FPDFAnnot_GetObject(FPDF_ANNOTATION annot, int index); 228 229 // Experimental API. 230 // Remove the object in |annot| at |index|. 231 // 232 // annot - handle to an annotation. 233 // index - the index of the object to be removed. 234 // 235 // Return true if successful. 236 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 237 FPDFAnnot_RemoveObject(FPDF_ANNOTATION annot, int index); 238 239 // Experimental API. 240 // Set the color of an annotation. Fails when called on annotations with 241 // appearance streams already defined; instead use 242 // FPDFPath_Set{Stroke|Fill}Color(). 243 // 244 // annot - handle to an annotation. 245 // type - type of the color to be set. 246 // R, G, B - buffer to hold the RGB value of the color. Ranges from 0 to 255. 247 // A - buffer to hold the opacity. Ranges from 0 to 255. 248 // 249 // Returns true if successful. 250 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetColor(FPDF_ANNOTATION annot, 251 FPDFANNOT_COLORTYPE type, 252 unsigned int R, 253 unsigned int G, 254 unsigned int B, 255 unsigned int A); 256 257 // Experimental API. 258 // Get the color of an annotation. If no color is specified, default to yellow 259 // for highlight annotation, black for all else. Fails when called on 260 // annotations with appearance streams already defined; instead use 261 // FPDFPath_Get{Stroke|Fill}Color(). 262 // 263 // annot - handle to an annotation. 264 // type - type of the color requested. 265 // R, G, B - buffer to hold the RGB value of the color. Ranges from 0 to 255. 266 // A - buffer to hold the opacity. Ranges from 0 to 255. 267 // 268 // Returns true if successful. 269 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetColor(FPDF_ANNOTATION annot, 270 FPDFANNOT_COLORTYPE type, 271 unsigned int* R, 272 unsigned int* G, 273 unsigned int* B, 274 unsigned int* A); 275 276 // Experimental API. 277 // Check if the annotation is of a type that has attachment points 278 // (i.e. quadpoints). Quadpoints are the vertices of the rectangle that 279 // encompasses the texts affected by the annotation. They provide the 280 // coordinates in the page where the annotation is attached. Only text markup 281 // annotations (i.e. highlight, strikeout, squiggly, and underline) and link 282 // annotations have quadpoints. 283 // 284 // annot - handle to an annotation. 285 // 286 // Returns true if the annotation is of a type that has quadpoints, false 287 // otherwise. 288 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 289 FPDFAnnot_HasAttachmentPoints(FPDF_ANNOTATION annot); 290 291 // Experimental API. 292 // Replace the attachment points (i.e. quadpoints) set of an annotation at 293 // |quad_index|. This index needs to be within the result of 294 // FPDFAnnot_CountAttachmentPoints(). 295 // If the annotation's appearance stream is defined and this annotation is of a 296 // type with quadpoints, then update the bounding box too if the new quadpoints 297 // define a bigger one. 298 // 299 // annot - handle to an annotation. 300 // quad_index - index of the set of quadpoints. 301 // quad_points - the quadpoints to be set. 302 // 303 // Returns true if successful. 304 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 305 FPDFAnnot_SetAttachmentPoints(FPDF_ANNOTATION annot, 306 size_t quad_index, 307 const FS_QUADPOINTSF* quad_points); 308 309 // Experimental API. 310 // Append to the list of attachment points (i.e. quadpoints) of an annotation. 311 // If the annotation's appearance stream is defined and this annotation is of a 312 // type with quadpoints, then update the bounding box too if the new quadpoints 313 // define a bigger one. 314 // 315 // annot - handle to an annotation. 316 // quad_points - the quadpoints to be set. 317 // 318 // Returns true if successful. 319 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 320 FPDFAnnot_AppendAttachmentPoints(FPDF_ANNOTATION annot, 321 const FS_QUADPOINTSF* quad_points); 322 323 // Experimental API. 324 // Get the number of sets of quadpoints of an annotation. 325 // 326 // annot - handle to an annotation. 327 // 328 // Returns the number of sets of quadpoints, or 0 on failure. 329 FPDF_EXPORT size_t FPDF_CALLCONV 330 FPDFAnnot_CountAttachmentPoints(FPDF_ANNOTATION annot); 331 332 // Experimental API. 333 // Get the attachment points (i.e. quadpoints) of an annotation. 334 // 335 // annot - handle to an annotation. 336 // quad_index - index of the set of quadpoints. 337 // quad_points - receives the quadpoints; must not be NULL. 338 // 339 // Returns true if successful. 340 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 341 FPDFAnnot_GetAttachmentPoints(FPDF_ANNOTATION annot, 342 size_t quad_index, 343 FS_QUADPOINTSF* quad_points); 344 345 // Experimental API. 346 // Set the annotation rectangle defining the location of the annotation. If the 347 // annotation's appearance stream is defined and this annotation is of a type 348 // without quadpoints, then update the bounding box too if the new rectangle 349 // defines a bigger one. 350 // 351 // annot - handle to an annotation. 352 // rect - the annotation rectangle to be set. 353 // 354 // Returns true if successful. 355 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetRect(FPDF_ANNOTATION annot, 356 const FS_RECTF* rect); 357 358 // Experimental API. 359 // Get the annotation rectangle defining the location of the annotation. 360 // 361 // annot - handle to an annotation. 362 // rect - receives the rectangle; must not be NULL. 363 // 364 // Returns true if successful. 365 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_GetRect(FPDF_ANNOTATION annot, 366 FS_RECTF* rect); 367 368 // Experimental API. 369 // Check if |annot|'s dictionary has |key| as a key. 370 // 371 // annot - handle to an annotation. 372 // key - the key to look for, encoded in UTF-8. 373 // 374 // Returns true if |key| exists. 375 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_HasKey(FPDF_ANNOTATION annot, 376 FPDF_BYTESTRING key); 377 378 // Experimental API. 379 // Get the type of the value corresponding to |key| in |annot|'s dictionary. 380 // 381 // annot - handle to an annotation. 382 // key - the key to look for, encoded in UTF-8. 383 // 384 // Returns the type of the dictionary value. 385 FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV 386 FPDFAnnot_GetValueType(FPDF_ANNOTATION annot, FPDF_BYTESTRING key); 387 388 // Experimental API. 389 // Set the string value corresponding to |key| in |annot|'s dictionary, 390 // overwriting the existing value if any. The value type would be 391 // FPDF_OBJECT_STRING after this function call succeeds. 392 // 393 // annot - handle to an annotation. 394 // key - the key to the dictionary entry to be set, encoded in UTF-8. 395 // value - the string value to be set, encoded in UTF-16LE. 396 // 397 // Returns true if successful. 398 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 399 FPDFAnnot_SetStringValue(FPDF_ANNOTATION annot, 400 FPDF_BYTESTRING key, 401 FPDF_WIDESTRING value); 402 403 // Experimental API. 404 // Get the string value corresponding to |key| in |annot|'s dictionary. |buffer| 405 // is only modified if |buflen| is longer than the length of contents. Note that 406 // if |key| does not exist in the dictionary or if |key|'s corresponding value 407 // in the dictionary is not a string (i.e. the value is not of type 408 // FPDF_OBJECT_STRING or FPDF_OBJECT_NAME), then an empty string would be copied 409 // to |buffer| and the return value would be 2. On other errors, nothing would 410 // be added to |buffer| and the return value would be 0. 411 // 412 // annot - handle to an annotation. 413 // key - the key to the requested dictionary entry, encoded in UTF-8. 414 // buffer - buffer for holding the value string, encoded in UTF-16LE. 415 // buflen - length of the buffer in bytes. 416 // 417 // Returns the length of the string value in bytes. 418 FPDF_EXPORT unsigned long FPDF_CALLCONV 419 FPDFAnnot_GetStringValue(FPDF_ANNOTATION annot, 420 FPDF_BYTESTRING key, 421 FPDF_WCHAR* buffer, 422 unsigned long buflen); 423 424 // Experimental API. 425 // Get the float value corresponding to |key| in |annot|'s dictionary. Writes 426 // value to |value| and returns True if |key| exists in the dictionary and 427 // |key|'s corresponding value is a number (FPDF_OBJECT_NUMBER), False 428 // otherwise. 429 // 430 // annot - handle to an annotation. 431 // key - the key to the requested dictionary entry, encoded in UTF-8. 432 // value - receives the value, must not be NULL. 433 // 434 // Returns True if value found, False otherwise. 435 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 436 FPDFAnnot_GetNumberValue(FPDF_ANNOTATION annot, 437 FPDF_BYTESTRING key, 438 float* value); 439 440 // Experimental API. 441 // Set the AP (appearance string) in |annot|'s dictionary for a given 442 // |appearanceMode|. 443 // 444 // annot - handle to an annotation. 445 // appearanceMode - the appearance mode (normal, rollover or down) for which 446 // to get the AP. 447 // value - the string value to be set, encoded in UTF-16LE. If 448 // nullptr is passed, the AP is cleared for that mode. If the 449 // mode is Normal, APs for all modes are cleared. 450 // 451 // Returns true if successful. 452 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 453 FPDFAnnot_SetAP(FPDF_ANNOTATION annot, 454 FPDF_ANNOT_APPEARANCEMODE appearanceMode, 455 FPDF_WIDESTRING value); 456 457 // Experimental API. 458 // Get the AP (appearance string) from |annot|'s dictionary for a given 459 // |appearanceMode|. 460 // |buffer| is only modified if |buflen| is large enough to hold the whole AP 461 // string. If |buflen| is smaller, the total size of the AP is still returned, 462 // but nothing is copied. 463 // If there is no appearance stream for |annot| in |appearanceMode|, an empty 464 // string is written to |buf| and 2 is returned. 465 // On other errors, nothing is written to |buffer| and 0 is returned. 466 // 467 // annot - handle to an annotation. 468 // appearanceMode - the appearance mode (normal, rollover or down) for which 469 // to get the AP. 470 // buffer - buffer for holding the value string, encoded in UTF-16LE. 471 // buflen - length of the buffer in bytes. 472 // 473 // Returns the length of the string value in bytes. 474 FPDF_EXPORT unsigned long FPDF_CALLCONV 475 FPDFAnnot_GetAP(FPDF_ANNOTATION annot, 476 FPDF_ANNOT_APPEARANCEMODE appearanceMode, 477 FPDF_WCHAR* buffer, 478 unsigned long buflen); 479 480 // Experimental API. 481 // Get the annotation corresponding to |key| in |annot|'s dictionary. Common 482 // keys for linking annotations include "IRT" and "Popup". Must call 483 // FPDFPage_CloseAnnot() when the annotation returned by this function is no 484 // longer needed. 485 // 486 // annot - handle to an annotation. 487 // key - the key to the requested dictionary entry, encoded in UTF-8. 488 // 489 // Returns a handle to the linked annotation object, or NULL on failure. 490 FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV 491 FPDFAnnot_GetLinkedAnnot(FPDF_ANNOTATION annot, FPDF_BYTESTRING key); 492 493 // Experimental API. 494 // Get the annotation flags of |annot|. 495 // 496 // annot - handle to an annotation. 497 // 498 // Returns the annotation flags. 499 FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetFlags(FPDF_ANNOTATION annot); 500 501 // Experimental API. 502 // Set the |annot|'s flags to be of the value |flags|. 503 // 504 // annot - handle to an annotation. 505 // flags - the flag values to be set. 506 // 507 // Returns true if successful. 508 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetFlags(FPDF_ANNOTATION annot, 509 int flags); 510 511 // Experimental API. 512 // Get the annotation flags of |annot|. 513 // 514 // hHandle - handle to the form fill module, returned by 515 // FPDFDOC_InitFormFillEnvironment(). 516 // annot - handle to an interactive form annotation. 517 // 518 // Returns the annotation flags specific to interactive forms. 519 FPDF_EXPORT int FPDF_CALLCONV 520 FPDFAnnot_GetFormFieldFlags(FPDF_FORMHANDLE handle, 521 FPDF_ANNOTATION annot); 522 523 // Experimental API. 524 // Retrieves an interactive form annotation whose rectangle contains a given 525 // point on a page. Must call FPDFPage_CloseAnnot() when the annotation returned 526 // is no longer needed. 527 // 528 // 529 // hHandle - handle to the form fill module, returned by 530 // FPDFDOC_InitFormFillEnvironment(). 531 // page - handle to the page, returned by FPDF_LoadPage function. 532 // point - position in PDF "user space". 533 // 534 // Returns the interactive form annotation whose rectangle contains the given 535 // coordinates on the page. If there is no such annotation, return NULL. 536 FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV 537 FPDFAnnot_GetFormFieldAtPoint(FPDF_FORMHANDLE hHandle, 538 FPDF_PAGE page, 539 const FS_POINTF* point); 540 541 // Experimental API. 542 // Gets the name of |annot|, which is an interactive form annotation. 543 // |buffer| is only modified if |buflen| is longer than the length of contents. 544 // In case of error, nothing will be added to |buffer| and the return value will 545 // be 0. Note that return value of empty string is 2 for "\0\0". 546 // 547 // hHandle - handle to the form fill module, returned by 548 // FPDFDOC_InitFormFillEnvironment(). 549 // annot - handle to an interactive form annotation. 550 // buffer - buffer for holding the name string, encoded in UTF-16LE. 551 // buflen - length of the buffer in bytes. 552 // 553 // Returns the length of the string value in bytes. 554 FPDF_EXPORT unsigned long FPDF_CALLCONV 555 FPDFAnnot_GetFormFieldName(FPDF_FORMHANDLE hHandle, 556 FPDF_ANNOTATION annot, 557 FPDF_WCHAR* buffer, 558 unsigned long buflen); 559 560 // Experimental API. 561 // Gets the form field type of |annot|, which is an interactive form annotation. 562 // 563 // hHandle - handle to the form fill module, returned by 564 // FPDFDOC_InitFormFillEnvironment(). 565 // annot - handle to an interactive form annotation. 566 // 567 // Returns the type of the form field (one of the FPDF_FORMFIELD_* values) on 568 // success. Returns -1 on error. 569 // See field types in fpdf_formfill.h. 570 FPDF_EXPORT int FPDF_CALLCONV 571 FPDFAnnot_GetFormFieldType(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot); 572 573 // Experimental API. 574 // Gets the value of |annot|, which is an interactive form annotation. 575 // |buffer| is only modified if |buflen| is longer than the length of contents. 576 // In case of error, nothing will be added to |buffer| and the return value will 577 // be 0. Note that return value of empty string is 2 for "\0\0". 578 // 579 // hHandle - handle to the form fill module, returned by 580 // FPDFDOC_InitFormFillEnvironment(). 581 // annot - handle to an interactive form annotation. 582 // buffer - buffer for holding the value string, encoded in UTF-16LE. 583 // buflen - length of the buffer in bytes. 584 // 585 // Returns the length of the string value in bytes. 586 FPDF_EXPORT unsigned long FPDF_CALLCONV 587 FPDFAnnot_GetFormFieldValue(FPDF_FORMHANDLE hHandle, 588 FPDF_ANNOTATION annot, 589 FPDF_WCHAR* buffer, 590 unsigned long buflen); 591 592 // Experimental API. 593 // Get the number of options in the |annot|'s "Opt" dictionary. Intended for 594 // use with listbox and combobox widget annotations. 595 // 596 // hHandle - handle to the form fill module, returned by 597 // FPDFDOC_InitFormFillEnvironment. 598 // annot - handle to an annotation. 599 // 600 // Returns the number of options in "Opt" dictionary on success. Return value 601 // will be -1 if annotation does not have an "Opt" dictionary or other error. 602 FPDF_EXPORT int FPDF_CALLCONV FPDFAnnot_GetOptionCount(FPDF_FORMHANDLE hHandle, 603 FPDF_ANNOTATION annot); 604 605 // Experimental API. 606 // Get the string value for the label of the option at |index| in |annot|'s 607 // "Opt" dictionary. Intended for use with listbox and combobox widget 608 // annotations. |buffer| is only modified if |buflen| is longer than the length 609 // of contents. If index is out of range or in case of other error, nothing 610 // will be added to |buffer| and the return value will be 0. Note that 611 // return value of empty string is 2 for "\0\0". 612 // 613 // hHandle - handle to the form fill module, returned by 614 // FPDFDOC_InitFormFillEnvironment. 615 // annot - handle to an annotation. 616 // index - numeric index of the option in the "Opt" array 617 // buffer - buffer for holding the value string, encoded in UTF-16LE. 618 // buflen - length of the buffer in bytes. 619 // 620 // Returns the length of the string value in bytes. 621 // If |annot| does not have an "Opt" array, |index| is out of range or if any 622 // other error occurs, returns 0. 623 FPDF_EXPORT unsigned long FPDF_CALLCONV 624 FPDFAnnot_GetOptionLabel(FPDF_FORMHANDLE hHandle, 625 FPDF_ANNOTATION annot, 626 int index, 627 FPDF_WCHAR* buffer, 628 unsigned long buflen); 629 630 // Experimental API. 631 // Get the float value of the font size for an |annot| with variable text. 632 // If 0, the font is to be auto-sized: its size is computed as a function of 633 // the height of the annotation rectangle. 634 // 635 // hHandle - handle to the form fill module, returned by 636 // FPDFDOC_InitFormFillEnvironment. 637 // annot - handle to an annotation. 638 // value - Required. Float which will be set to font size on success. 639 // 640 // Returns true if the font size was set in |value|, false on error or if 641 // |value| not provided. 642 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 643 FPDFAnnot_GetFontSize(FPDF_FORMHANDLE hHandle, 644 FPDF_ANNOTATION annot, 645 float* value); 646 647 // Experimental API. 648 // Determine if |annot| is a form widget that is checked. Intended for use with 649 // checkbox and radio button widgets. 650 // 651 // hHandle - handle to the form fill module, returned by 652 // FPDFDOC_InitFormFillEnvironment. 653 // annot - handle to an annotation. 654 // 655 // Returns true if |annot| is a form widget and is checked, false otherwise. 656 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_IsChecked(FPDF_FORMHANDLE hHandle, 657 FPDF_ANNOTATION annot); 658 659 #ifdef __cplusplus 660 } // extern "C" 661 #endif // __cplusplus 662 663 #endif // PUBLIC_FPDF_ANNOT_H_ 664