• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_EDIT_H_
8 #define PUBLIC_FPDF_EDIT_H_
9 
10 #include <stdint.h>
11 
12 // NOLINTNEXTLINE(build/include)
13 #include "fpdfview.h"
14 
15 #define FPDF_ARGB(a, r, g, b)                                      \
16   ((uint32_t)(((uint32_t)(b)&0xff) | (((uint32_t)(g)&0xff) << 8) | \
17               (((uint32_t)(r)&0xff) << 16) | (((uint32_t)(a)&0xff) << 24)))
18 #define FPDF_GetBValue(argb) ((uint8_t)(argb))
19 #define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8))
20 #define FPDF_GetRValue(argb) ((uint8_t)((argb) >> 16))
21 #define FPDF_GetAValue(argb) ((uint8_t)((argb) >> 24))
22 
23 // Refer to PDF Reference version 1.7 table 4.12 for all color space families.
24 #define FPDF_COLORSPACE_UNKNOWN 0
25 #define FPDF_COLORSPACE_DEVICEGRAY 1
26 #define FPDF_COLORSPACE_DEVICERGB 2
27 #define FPDF_COLORSPACE_DEVICECMYK 3
28 #define FPDF_COLORSPACE_CALGRAY 4
29 #define FPDF_COLORSPACE_CALRGB 5
30 #define FPDF_COLORSPACE_LAB 6
31 #define FPDF_COLORSPACE_ICCBASED 7
32 #define FPDF_COLORSPACE_SEPARATION 8
33 #define FPDF_COLORSPACE_DEVICEN 9
34 #define FPDF_COLORSPACE_INDEXED 10
35 #define FPDF_COLORSPACE_PATTERN 11
36 
37 // The page object constants.
38 #define FPDF_PAGEOBJ_UNKNOWN 0
39 #define FPDF_PAGEOBJ_TEXT 1
40 #define FPDF_PAGEOBJ_PATH 2
41 #define FPDF_PAGEOBJ_IMAGE 3
42 #define FPDF_PAGEOBJ_SHADING 4
43 #define FPDF_PAGEOBJ_FORM 5
44 
45 // The path segment constants.
46 #define FPDF_SEGMENT_UNKNOWN -1
47 #define FPDF_SEGMENT_LINETO 0
48 #define FPDF_SEGMENT_BEZIERTO 1
49 #define FPDF_SEGMENT_MOVETO 2
50 
51 #define FPDF_FILLMODE_NONE 0
52 #define FPDF_FILLMODE_ALTERNATE 1
53 #define FPDF_FILLMODE_WINDING 2
54 
55 #define FPDF_FONT_TYPE1 1
56 #define FPDF_FONT_TRUETYPE 2
57 
58 #define FPDF_LINECAP_BUTT 0
59 #define FPDF_LINECAP_ROUND 1
60 #define FPDF_LINECAP_PROJECTING_SQUARE 2
61 
62 #define FPDF_LINEJOIN_MITER 0
63 #define FPDF_LINEJOIN_ROUND 1
64 #define FPDF_LINEJOIN_BEVEL 2
65 
66 #define FPDF_PRINTMODE_EMF 0
67 #define FPDF_PRINTMODE_TEXTONLY 1
68 #define FPDF_PRINTMODE_POSTSCRIPT2 2
69 #define FPDF_PRINTMODE_POSTSCRIPT3 3
70 #define FPDF_PRINTMODE_POSTSCRIPT2_PASSTHROUGH 4
71 #define FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH 5
72 
73 typedef struct FPDF_IMAGEOBJ_METADATA {
74   // The image width in pixels.
75   unsigned int width;
76   // The image height in pixels.
77   unsigned int height;
78   // The image's horizontal pixel-per-inch.
79   float horizontal_dpi;
80   // The image's vertical pixel-per-inch.
81   float vertical_dpi;
82   // The number of bits used to represent each pixel.
83   unsigned int bits_per_pixel;
84   // The image's colorspace. See above for the list of FPDF_COLORSPACE_*.
85   int colorspace;
86   // The image's marked content ID. Useful for pairing with associated alt-text.
87   // A value of -1 indicates no ID.
88   int marked_content_id;
89 } FPDF_IMAGEOBJ_METADATA;
90 
91 #ifdef __cplusplus
92 extern "C" {
93 #endif  // __cplusplus
94 
95 // Create a new PDF document.
96 //
97 // Returns a handle to a new document, or NULL on failure.
98 FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument();
99 
100 // Create a new PDF page.
101 //
102 //   document   - handle to document.
103 //   page_index - suggested 0-based index of the page to create. If it is larger
104 //                than document's current last index(L), the created page index
105 //                is the next available index -- L+1.
106 //   width      - the page width in points.
107 //   height     - the page height in points.
108 //
109 // Returns the handle to the new page or NULL on failure.
110 //
111 // The page should be closed with FPDF_ClosePage() when finished as
112 // with any other page in the document.
113 FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDFPage_New(FPDF_DOCUMENT document,
114                                                  int page_index,
115                                                  double width,
116                                                  double height);
117 
118 // Delete the page at |page_index|.
119 //
120 //   document   - handle to document.
121 //   page_index - the index of the page to delete.
122 FPDF_EXPORT void FPDF_CALLCONV FPDFPage_Delete(FPDF_DOCUMENT document,
123                                                int page_index);
124 
125 // Get the rotation of |page|.
126 //
127 //   page - handle to a page
128 //
129 // Returns one of the following indicating the page rotation:
130 //   0 - No rotation.
131 //   1 - Rotated 90 degrees clockwise.
132 //   2 - Rotated 180 degrees clockwise.
133 //   3 - Rotated 270 degrees clockwise.
134 FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetRotation(FPDF_PAGE page);
135 
136 // Set rotation for |page|.
137 //
138 //   page   - handle to a page.
139 //   rotate - the rotation value, one of:
140 //              0 - No rotation.
141 //              1 - Rotated 90 degrees clockwise.
142 //              2 - Rotated 180 degrees clockwise.
143 //              3 - Rotated 270 degrees clockwise.
144 FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetRotation(FPDF_PAGE page, int rotate);
145 
146 // Insert |page_obj| into |page|.
147 //
148 //   page     - handle to a page
149 //   page_obj - handle to a page object. The |page_obj| will be automatically
150 //              freed.
151 FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertObject(FPDF_PAGE page,
152                                                      FPDF_PAGEOBJECT page_obj);
153 
154 // Experimental API.
155 // Remove |page_obj| from |page|.
156 //
157 //   page     - handle to a page
158 //   page_obj - handle to a page object to be removed.
159 //
160 // Returns TRUE on success.
161 //
162 // Ownership is transferred to the caller. Call FPDFPageObj_Destroy() to free
163 // it.
164 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
165 FPDFPage_RemoveObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_obj);
166 
167 // Get number of page objects inside |page|.
168 //
169 //   page - handle to a page.
170 //
171 // Returns the number of objects in |page|.
172 FPDF_EXPORT int FPDF_CALLCONV FPDFPage_CountObjects(FPDF_PAGE page);
173 
174 // Get object in |page| at |index|.
175 //
176 //   page  - handle to a page.
177 //   index - the index of a page object.
178 //
179 // Returns the handle to the page object, or NULL on failed.
180 FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPage_GetObject(FPDF_PAGE page,
181                                                              int index);
182 
183 // Checks if |page| contains transparency.
184 //
185 //   page - handle to a page.
186 //
187 // Returns TRUE if |page| contains transparency.
188 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_HasTransparency(FPDF_PAGE page);
189 
190 // Generate the content of |page|.
191 //
192 //   page - handle to a page.
193 //
194 // Returns TRUE on success.
195 //
196 // Before you save the page to a file, or reload the page, you must call
197 // |FPDFPage_GenerateContent| or any changes to |page| will be lost.
198 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GenerateContent(FPDF_PAGE page);
199 
200 // Destroy |page_obj| by releasing its resources. |page_obj| must have been
201 // created by FPDFPageObj_CreateNew{Path|Rect}() or
202 // FPDFPageObj_New{Text|Image}Obj(). This function must be called on
203 // newly-created objects if they are not added to a page through
204 // FPDFPage_InsertObject() or to an annotation through FPDFAnnot_AppendObject().
205 //
206 //   page_obj - handle to a page object.
207 FPDF_EXPORT void FPDF_CALLCONV FPDFPageObj_Destroy(FPDF_PAGEOBJECT page_obj);
208 
209 // Checks if |page_object| contains transparency.
210 //
211 //   page_object - handle to a page object.
212 //
213 // Returns TRUE if |page_object| contains transparency.
214 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
215 FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT page_object);
216 
217 // Get type of |page_object|.
218 //
219 //   page_object - handle to a page object.
220 //
221 // Returns one of the FPDF_PAGEOBJ_* values on success, FPDF_PAGEOBJ_UNKNOWN on
222 // error.
223 FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetType(FPDF_PAGEOBJECT page_object);
224 
225 // Transform |page_object| by the given matrix.
226 //
227 //   page_object - handle to a page object.
228 //   a           - matrix value.
229 //   b           - matrix value.
230 //   c           - matrix value.
231 //   d           - matrix value.
232 //   e           - matrix value.
233 //   f           - matrix value.
234 //
235 // The matrix is composed as:
236 //   |a c e|
237 //   |b d f|
238 // and can be used to scale, rotate, shear and translate the |page_object|.
239 FPDF_EXPORT void FPDF_CALLCONV
240 FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
241                       double a,
242                       double b,
243                       double c,
244                       double d,
245                       double e,
246                       double f);
247 
248 // Transform all annotations in |page|.
249 //
250 //   page - handle to a page.
251 //   a    - matrix value.
252 //   b    - matrix value.
253 //   c    - matrix value.
254 //   d    - matrix value.
255 //   e    - matrix value.
256 //   f    - matrix value.
257 //
258 // The matrix is composed as:
259 //   |a c e|
260 //   |b d f|
261 // and can be used to scale, rotate, shear and translate the |page| annotations.
262 FPDF_EXPORT void FPDF_CALLCONV FPDFPage_TransformAnnots(FPDF_PAGE page,
263                                                         double a,
264                                                         double b,
265                                                         double c,
266                                                         double d,
267                                                         double e,
268                                                         double f);
269 
270 // Create a new image object.
271 //
272 //   document - handle to a document.
273 //
274 // Returns a handle to a new image object.
275 FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
276 FPDFPageObj_NewImageObj(FPDF_DOCUMENT document);
277 
278 // Experimental API.
279 // Get number of content marks in |page_object|.
280 //
281 //   page_object - handle to a page object.
282 //
283 // Returns the number of content marks in |page_object|, or -1 in case of
284 // failure.
285 FPDF_EXPORT int FPDF_CALLCONV
286 FPDFPageObj_CountMarks(FPDF_PAGEOBJECT page_object);
287 
288 // Experimental API.
289 // Get content mark in |page_object| at |index|.
290 //
291 //   page_object - handle to a page object.
292 //   index       - the index of a page object.
293 //
294 // Returns the handle to the content mark, or NULL on failure. The handle is
295 // still owned by the library, and it should not be freed directly. It becomes
296 // invalid if the page object is destroyed, either directly or indirectly by
297 // unloading the page.
298 FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV
299 FPDFPageObj_GetMark(FPDF_PAGEOBJECT page_object, unsigned long index);
300 
301 // Experimental API.
302 // Add a new content mark to a |page_object|.
303 //
304 //   page_object - handle to a page object.
305 //   name        - the name (tag) of the mark.
306 //
307 // Returns the handle to the content mark, or NULL on failure. The handle is
308 // still owned by the library, and it should not be freed directly. It becomes
309 // invalid if the page object is destroyed, either directly or indirectly by
310 // unloading the page.
311 FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV
312 FPDFPageObj_AddMark(FPDF_PAGEOBJECT page_object, FPDF_BYTESTRING name);
313 
314 // Experimental API.
315 // Removes a content |mark| from a |page_object|.
316 // The mark handle will be invalid after the removal.
317 //
318 //   page_object - handle to a page object.
319 //   mark        - handle to a content mark in that object to remove.
320 //
321 // Returns TRUE if the operation succeeded, FALSE if it failed.
322 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
323 FPDFPageObj_RemoveMark(FPDF_PAGEOBJECT page_object, FPDF_PAGEOBJECTMARK mark);
324 
325 // Experimental API.
326 // Get the name of a content mark.
327 //
328 //   mark       - handle to a content mark.
329 //   buffer     - buffer for holding the returned name in UTF-16LE. This is only
330 //                modified if |buflen| is longer than the length of the name.
331 //                Optional, pass null to just retrieve the size of the buffer
332 //                needed.
333 //   buflen     - length of the buffer.
334 //   out_buflen - pointer to variable that will receive the minimum buffer size
335 //                to contain the name. Not filled if FALSE is returned.
336 //
337 // Returns TRUE if the operation succeeded, FALSE if it failed.
338 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
339 FPDFPageObjMark_GetName(FPDF_PAGEOBJECTMARK mark,
340                         void* buffer,
341                         unsigned long buflen,
342                         unsigned long* out_buflen);
343 
344 // Experimental API.
345 // Get the number of key/value pair parameters in |mark|.
346 //
347 //   mark   - handle to a content mark.
348 //
349 // Returns the number of key/value pair parameters |mark|, or -1 in case of
350 // failure.
351 FPDF_EXPORT int FPDF_CALLCONV
352 FPDFPageObjMark_CountParams(FPDF_PAGEOBJECTMARK mark);
353 
354 // Experimental API.
355 // Get the key of a property in a content mark.
356 //
357 //   mark       - handle to a content mark.
358 //   index      - index of the property.
359 //   buffer     - buffer for holding the returned key in UTF-16LE. This is only
360 //                modified if |buflen| is longer than the length of the key.
361 //                Optional, pass null to just retrieve the size of the buffer
362 //                needed.
363 //   buflen     - length of the buffer.
364 //   out_buflen - pointer to variable that will receive the minimum buffer size
365 //                to contain the key. Not filled if FALSE is returned.
366 //
367 // Returns TRUE if the operation was successful, FALSE otherwise.
368 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
369 FPDFPageObjMark_GetParamKey(FPDF_PAGEOBJECTMARK mark,
370                             unsigned long index,
371                             void* buffer,
372                             unsigned long buflen,
373                             unsigned long* out_buflen);
374 
375 // Experimental API.
376 // Get the type of the value of a property in a content mark by key.
377 //
378 //   mark   - handle to a content mark.
379 //   key    - string key of the property.
380 //
381 // Returns the type of the value, or FPDF_OBJECT_UNKNOWN in case of failure.
382 FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV
383 FPDFPageObjMark_GetParamValueType(FPDF_PAGEOBJECTMARK mark,
384                                   FPDF_BYTESTRING key);
385 
386 // Experimental API.
387 // Get the value of a number property in a content mark by key as int.
388 // FPDFPageObjMark_GetParamValueType() should have returned FPDF_OBJECT_NUMBER
389 // for this property.
390 //
391 //   mark      - handle to a content mark.
392 //   key       - string key of the property.
393 //   out_value - pointer to variable that will receive the value. Not filled if
394 //               false is returned.
395 //
396 // Returns TRUE if the key maps to a number value, FALSE otherwise.
397 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
398 FPDFPageObjMark_GetParamIntValue(FPDF_PAGEOBJECTMARK mark,
399                                  FPDF_BYTESTRING key,
400                                  int* out_value);
401 
402 // Experimental API.
403 // Get the value of a string property in a content mark by key.
404 //
405 //   mark       - handle to a content mark.
406 //   key        - string key of the property.
407 //   buffer     - buffer for holding the returned value in UTF-16LE. This is
408 //                only modified if |buflen| is longer than the length of the
409 //                value.
410 //                Optional, pass null to just retrieve the size of the buffer
411 //                needed.
412 //   buflen     - length of the buffer.
413 //   out_buflen - pointer to variable that will receive the minimum buffer size
414 //                to contain the value. Not filled if FALSE is returned.
415 //
416 // Returns TRUE if the key maps to a string/blob value, FALSE otherwise.
417 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
418 FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark,
419                                     FPDF_BYTESTRING key,
420                                     void* buffer,
421                                     unsigned long buflen,
422                                     unsigned long* out_buflen);
423 
424 // Experimental API.
425 // Get the value of a blob property in a content mark by key.
426 //
427 //   mark       - handle to a content mark.
428 //   key        - string key of the property.
429 //   buffer     - buffer for holding the returned value. This is only modified
430 //                if |buflen| is at least as long as the length of the value.
431 //                Optional, pass null to just retrieve the size of the buffer
432 //                needed.
433 //   buflen     - length of the buffer.
434 //   out_buflen - pointer to variable that will receive the minimum buffer size
435 //                to contain the value. Not filled if FALSE is returned.
436 //
437 // Returns TRUE if the key maps to a string/blob value, FALSE otherwise.
438 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
439 FPDFPageObjMark_GetParamBlobValue(FPDF_PAGEOBJECTMARK mark,
440                                   FPDF_BYTESTRING key,
441                                   void* buffer,
442                                   unsigned long buflen,
443                                   unsigned long* out_buflen);
444 
445 // Experimental API.
446 // Set the value of an int property in a content mark by key. If a parameter
447 // with key |key| exists, its value is set to |value|. Otherwise, it is added as
448 // a new parameter.
449 //
450 //   document    - handle to the document.
451 //   page_object - handle to the page object with the mark.
452 //   mark        - handle to a content mark.
453 //   key         - string key of the property.
454 //   value       - int value to set.
455 //
456 // Returns TRUE if the operation succeeded, FALSE otherwise.
457 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
458 FPDFPageObjMark_SetIntParam(FPDF_DOCUMENT document,
459                             FPDF_PAGEOBJECT page_object,
460                             FPDF_PAGEOBJECTMARK mark,
461                             FPDF_BYTESTRING key,
462                             int value);
463 
464 // Experimental API.
465 // Set the value of a string property in a content mark by key. If a parameter
466 // with key |key| exists, its value is set to |value|. Otherwise, it is added as
467 // a new parameter.
468 //
469 //   document    - handle to the document.
470 //   page_object - handle to the page object with the mark.
471 //   mark        - handle to a content mark.
472 //   key         - string key of the property.
473 //   value       - string value to set.
474 //
475 // Returns TRUE if the operation succeeded, FALSE otherwise.
476 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
477 FPDFPageObjMark_SetStringParam(FPDF_DOCUMENT document,
478                                FPDF_PAGEOBJECT page_object,
479                                FPDF_PAGEOBJECTMARK mark,
480                                FPDF_BYTESTRING key,
481                                FPDF_BYTESTRING value);
482 
483 // Experimental API.
484 // Set the value of a blob property in a content mark by key. If a parameter
485 // with key |key| exists, its value is set to |value|. Otherwise, it is added as
486 // a new parameter.
487 //
488 //   document    - handle to the document.
489 //   page_object - handle to the page object with the mark.
490 //   mark        - handle to a content mark.
491 //   key         - string key of the property.
492 //   value       - pointer to blob value to set.
493 //   value_len   - size in bytes of |value|.
494 //
495 // Returns TRUE if the operation succeeded, FALSE otherwise.
496 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
497 FPDFPageObjMark_SetBlobParam(FPDF_DOCUMENT document,
498                              FPDF_PAGEOBJECT page_object,
499                              FPDF_PAGEOBJECTMARK mark,
500                              FPDF_BYTESTRING key,
501                              void* value,
502                              unsigned long value_len);
503 
504 // Experimental API.
505 // Removes a property from a content mark by key.
506 //
507 //   page_object - handle to the page object with the mark.
508 //   mark        - handle to a content mark.
509 //   key         - string key of the property.
510 //
511 // Returns TRUE if the operation succeeded, FALSE otherwise.
512 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
513 FPDFPageObjMark_RemoveParam(FPDF_PAGEOBJECT page_object,
514                             FPDF_PAGEOBJECTMARK mark,
515                             FPDF_BYTESTRING key);
516 
517 // Load an image from a JPEG image file and then set it into |image_object|.
518 //
519 //   pages        - pointer to the start of all loaded pages, may be NULL.
520 //   count        - number of |pages|, may be 0.
521 //   image_object - handle to an image object.
522 //   file_access  - file access handler which specifies the JPEG image file.
523 //
524 // Returns TRUE on success.
525 //
526 // The image object might already have an associated image, which is shared and
527 // cached by the loaded pages. In that case, we need to clear the cached image
528 // for all the loaded pages. Pass |pages| and page count (|count|) to this API
529 // to clear the image cache. If the image is not previously shared, or NULL is a
530 // valid |pages| value.
531 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
532 FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages,
533                           int count,
534                           FPDF_PAGEOBJECT image_object,
535                           FPDF_FILEACCESS* file_access);
536 
537 // Load an image from a JPEG image file and then set it into |image_object|.
538 //
539 //   pages        - pointer to the start of all loaded pages, may be NULL.
540 //   count        - number of |pages|, may be 0.
541 //   image_object - handle to an image object.
542 //   file_access  - file access handler which specifies the JPEG image file.
543 //
544 // Returns TRUE on success.
545 //
546 // The image object might already have an associated image, which is shared and
547 // cached by the loaded pages. In that case, we need to clear the cached image
548 // for all the loaded pages. Pass |pages| and page count (|count|) to this API
549 // to clear the image cache. If the image is not previously shared, or NULL is a
550 // valid |pages| value. This function loads the JPEG image inline, so the image
551 // content is copied to the file. This allows |file_access| and its associated
552 // data to be deleted after this function returns.
553 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
554 FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages,
555                                 int count,
556                                 FPDF_PAGEOBJECT image_object,
557                                 FPDF_FILEACCESS* file_access);
558 
559 // Experimental API.
560 // Get the transform matrix of an image object.
561 //
562 //   image_object - handle to an image object.
563 //   a            - matrix value.
564 //   b            - matrix value.
565 //   c            - matrix value.
566 //   d            - matrix value.
567 //   e            - matrix value.
568 //   f            - matrix value.
569 //
570 // The matrix is composed as:
571 //   |a c e|
572 //   |b d f|
573 // and used to scale, rotate, shear and translate the image.
574 //
575 // Returns TRUE on success.
576 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
577 FPDFImageObj_GetMatrix(FPDF_PAGEOBJECT image_object,
578                        double* a,
579                        double* b,
580                        double* c,
581                        double* d,
582                        double* e,
583                        double* f);
584 
585 // Set the transform matrix of |image_object|.
586 //
587 //   image_object - handle to an image object.
588 //   a            - matrix value.
589 //   b            - matrix value.
590 //   c            - matrix value.
591 //   d            - matrix value.
592 //   e            - matrix value.
593 //   f            - matrix value.
594 //
595 // The matrix is composed as:
596 //   |a c e|
597 //   |b d f|
598 // and can be used to scale, rotate, shear and translate the |image_object|.
599 //
600 // Returns TRUE on success.
601 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
602 FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
603                        double a,
604                        double b,
605                        double c,
606                        double d,
607                        double e,
608                        double f);
609 
610 // Set |bitmap| to |image_object|.
611 //
612 //   pages        - pointer to the start of all loaded pages, may be NULL.
613 //   count        - number of |pages|, may be 0.
614 //   image_object - handle to an image object.
615 //   bitmap       - handle of the bitmap.
616 //
617 // Returns TRUE on success.
618 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
619 FPDFImageObj_SetBitmap(FPDF_PAGE* pages,
620                        int count,
621                        FPDF_PAGEOBJECT image_object,
622                        FPDF_BITMAP bitmap);
623 
624 // Get a bitmap rasterisation of |image_object|. The returned bitmap will be
625 // owned by the caller, and FPDFBitmap_Destroy() must be called on the returned
626 // bitmap when it is no longer needed.
627 //
628 //   image_object - handle to an image object.
629 //
630 // Returns the bitmap.
631 FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV
632 FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object);
633 
634 // Get the decoded image data of |image_object|. The decoded data is the
635 // uncompressed image data, i.e. the raw image data after having all filters
636 // applied. |buffer| is only modified if |buflen| is longer than the length of
637 // the decoded image data.
638 //
639 //   image_object - handle to an image object.
640 //   buffer       - buffer for holding the decoded image data.
641 //   buflen       - length of the buffer in bytes.
642 //
643 // Returns the length of the decoded image data.
644 FPDF_EXPORT unsigned long FPDF_CALLCONV
645 FPDFImageObj_GetImageDataDecoded(FPDF_PAGEOBJECT image_object,
646                                  void* buffer,
647                                  unsigned long buflen);
648 
649 // Get the raw image data of |image_object|. The raw data is the image data as
650 // stored in the PDF without applying any filters. |buffer| is only modified if
651 // |buflen| is longer than the length of the raw image data.
652 //
653 //   image_object - handle to an image object.
654 //   buffer       - buffer for holding the raw image data.
655 //   buflen       - length of the buffer in bytes.
656 //
657 // Returns the length of the raw image data.
658 FPDF_EXPORT unsigned long FPDF_CALLCONV
659 FPDFImageObj_GetImageDataRaw(FPDF_PAGEOBJECT image_object,
660                              void* buffer,
661                              unsigned long buflen);
662 
663 // Get the number of filters (i.e. decoders) of the image in |image_object|.
664 //
665 //   image_object - handle to an image object.
666 //
667 // Returns the number of |image_object|'s filters.
668 FPDF_EXPORT int FPDF_CALLCONV
669 FPDFImageObj_GetImageFilterCount(FPDF_PAGEOBJECT image_object);
670 
671 // Get the filter at |index| of |image_object|'s list of filters. Note that the
672 // filters need to be applied in order, i.e. the first filter should be applied
673 // first, then the second, etc. |buffer| is only modified if |buflen| is longer
674 // than the length of the filter string.
675 //
676 //   image_object - handle to an image object.
677 //   index        - the index of the filter requested.
678 //   buffer       - buffer for holding filter string, encoded in UTF-8.
679 //   buflen       - length of the buffer.
680 //
681 // Returns the length of the filter string.
682 FPDF_EXPORT unsigned long FPDF_CALLCONV
683 FPDFImageObj_GetImageFilter(FPDF_PAGEOBJECT image_object,
684                             int index,
685                             void* buffer,
686                             unsigned long buflen);
687 
688 // Get the image metadata of |image_object|, including dimension, DPI, bits per
689 // pixel, and colorspace. If the |image_object| is not an image object or if it
690 // does not have an image, then the return value will be false. Otherwise,
691 // failure to retrieve any specific parameter would result in its value being 0.
692 //
693 //   image_object - handle to an image object.
694 //   page         - handle to the page that |image_object| is on. Required for
695 //                  retrieving the image's bits per pixel and colorspace.
696 //   metadata     - receives the image metadata; must not be NULL.
697 //
698 // Returns true if successful.
699 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
700 FPDFImageObj_GetImageMetadata(FPDF_PAGEOBJECT image_object,
701                               FPDF_PAGE page,
702                               FPDF_IMAGEOBJ_METADATA* metadata);
703 
704 // Create a new path object at an initial position.
705 //
706 //   x - initial horizontal position.
707 //   y - initial vertical position.
708 //
709 // Returns a handle to a new path object.
710 FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewPath(float x,
711                                                                     float y);
712 
713 // Create a closed path consisting of a rectangle.
714 //
715 //   x - horizontal position for the left boundary of the rectangle.
716 //   y - vertical position for the bottom boundary of the rectangle.
717 //   w - width of the rectangle.
718 //   h - height of the rectangle.
719 //
720 // Returns a handle to the new path object.
721 FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewRect(float x,
722                                                                     float y,
723                                                                     float w,
724                                                                     float h);
725 
726 // Get the bounding box of |page_object|.
727 //
728 // page_object  - handle to a page object.
729 // left         - pointer where the left coordinate will be stored
730 // bottom       - pointer where the bottom coordinate will be stored
731 // right        - pointer where the right coordinate will be stored
732 // top          - pointer where the top coordinate will be stored
733 //
734 // Returns TRUE on success.
735 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
736 FPDFPageObj_GetBounds(FPDF_PAGEOBJECT page_object,
737                       float* left,
738                       float* bottom,
739                       float* right,
740                       float* top);
741 
742 // Set the blend mode of |page_object|.
743 //
744 // page_object  - handle to a page object.
745 // blend_mode   - string containing the blend mode.
746 //
747 // Blend mode can be one of following: Color, ColorBurn, ColorDodge, Darken,
748 // Difference, Exclusion, HardLight, Hue, Lighten, Luminosity, Multiply, Normal,
749 // Overlay, Saturation, Screen, SoftLight
750 FPDF_EXPORT void FPDF_CALLCONV
751 FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object,
752                          FPDF_BYTESTRING blend_mode);
753 
754 // Set the stroke RGBA of a page object. Range of values: 0 - 255.
755 //
756 // page_object  - the handle to the page object.
757 // R            - the red component for the object's stroke color.
758 // G            - the green component for the object's stroke color.
759 // B            - the blue component for the object's stroke color.
760 // A            - the stroke alpha for the object.
761 //
762 // Returns TRUE on success.
763 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
764 FPDFPageObj_SetStrokeColor(FPDF_PAGEOBJECT page_object,
765                            unsigned int R,
766                            unsigned int G,
767                            unsigned int B,
768                            unsigned int A);
769 
770 // Get the stroke RGBA of a page object. Range of values: 0 - 255.
771 //
772 // page_object  - the handle to the page object.
773 // R            - the red component of the path stroke color.
774 // G            - the green component of the object's stroke color.
775 // B            - the blue component of the object's stroke color.
776 // A            - the stroke alpha of the object.
777 //
778 // Returns TRUE on success.
779 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
780 FPDFPageObj_GetStrokeColor(FPDF_PAGEOBJECT page_object,
781                            unsigned int* R,
782                            unsigned int* G,
783                            unsigned int* B,
784                            unsigned int* A);
785 
786 // Set the stroke width of a page object.
787 //
788 // path   - the handle to the page object.
789 // width  - the width of the stroke.
790 //
791 // Returns TRUE on success
792 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
793 FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width);
794 
795 // Experimental API.
796 // Get the stroke width of a page object.
797 //
798 // path   - the handle to the page object.
799 // width  - the width of the stroke.
800 //
801 // Returns TRUE on success
802 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
803 FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width);
804 
805 // Get the line join of |page_object|.
806 //
807 // page_object  - handle to a page object.
808 //
809 // Returns the line join, or -1 on failure.
810 // Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND,
811 // FPDF_LINEJOIN_BEVEL
812 FPDF_EXPORT int FPDF_CALLCONV
813 FPDFPageObj_GetLineJoin(FPDF_PAGEOBJECT page_object);
814 
815 // Set the line join of |page_object|.
816 //
817 // page_object  - handle to a page object.
818 // line_join    - line join
819 //
820 // Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND,
821 // FPDF_LINEJOIN_BEVEL
822 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
823 FPDFPageObj_SetLineJoin(FPDF_PAGEOBJECT page_object, int line_join);
824 
825 // Get the line cap of |page_object|.
826 //
827 // page_object - handle to a page object.
828 //
829 // Returns the line cap, or -1 on failure.
830 // Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND,
831 // FPDF_LINECAP_PROJECTING_SQUARE
832 FPDF_EXPORT int FPDF_CALLCONV
833 FPDFPageObj_GetLineCap(FPDF_PAGEOBJECT page_object);
834 
835 // Set the line cap of |page_object|.
836 //
837 // page_object - handle to a page object.
838 // line_cap    - line cap
839 //
840 // Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND,
841 // FPDF_LINECAP_PROJECTING_SQUARE
842 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
843 FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap);
844 
845 // Set the fill RGBA of a page object. Range of values: 0 - 255.
846 //
847 // page_object  - the handle to the page object.
848 // R            - the red component for the object's fill color.
849 // G            - the green component for the object's fill color.
850 // B            - the blue component for the object's fill color.
851 // A            - the fill alpha for the object.
852 //
853 // Returns TRUE on success.
854 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
855 FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object,
856                          unsigned int R,
857                          unsigned int G,
858                          unsigned int B,
859                          unsigned int A);
860 
861 // Get the fill RGBA of a page object. Range of values: 0 - 255.
862 //
863 // page_object  - the handle to the page object.
864 // R            - the red component of the object's fill color.
865 // G            - the green component of the object's fill color.
866 // B            - the blue component of the object's fill color.
867 // A            - the fill alpha of the object.
868 //
869 // Returns TRUE on success.
870 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
871 FPDFPageObj_GetFillColor(FPDF_PAGEOBJECT page_object,
872                          unsigned int* R,
873                          unsigned int* G,
874                          unsigned int* B,
875                          unsigned int* A);
876 
877 // Experimental API.
878 // Get number of segments inside |path|.
879 //
880 //   path - handle to a path.
881 //
882 // A segment is a command, created by e.g. FPDFPath_MoveTo(),
883 // FPDFPath_LineTo() or FPDFPath_BezierTo().
884 //
885 // Returns the number of objects in |path| or -1 on failure.
886 FPDF_EXPORT int FPDF_CALLCONV FPDFPath_CountSegments(FPDF_PAGEOBJECT path);
887 
888 // Experimental API.
889 // Get segment in |path| at |index|.
890 //
891 //   path  - handle to a path.
892 //   index - the index of a segment.
893 //
894 // Returns the handle to the segment, or NULL on faiure.
895 FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV
896 FPDFPath_GetPathSegment(FPDF_PAGEOBJECT path, int index);
897 
898 // Experimental API.
899 // Get coordinates of |segment|.
900 //
901 //   segment  - handle to a segment.
902 //   x      - the horizontal position of the segment.
903 //   y      - the vertical position of the segment.
904 //
905 // Returns TRUE on success, otherwise |x| and |y| is not set.
906 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
907 FPDFPathSegment_GetPoint(FPDF_PATHSEGMENT segment, float* x, float* y);
908 
909 // Experimental API.
910 // Get type of |segment|.
911 //
912 //   segment - handle to a segment.
913 //
914 // Returns one of the FPDF_SEGMENT_* values on success,
915 // FPDF_SEGMENT_UNKNOWN on error.
916 FPDF_EXPORT int FPDF_CALLCONV FPDFPathSegment_GetType(FPDF_PATHSEGMENT segment);
917 
918 // Experimental API.
919 // Gets if the |segment| closes the current subpath of a given path.
920 //
921 //   segment - handle to a segment.
922 //
923 // Returns close flag for non-NULL segment, FALSE otherwise.
924 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
925 FPDFPathSegment_GetClose(FPDF_PATHSEGMENT segment);
926 
927 // Move a path's current point.
928 //
929 // path   - the handle to the path object.
930 // x      - the horizontal position of the new current point.
931 // y      - the vertical position of the new current point.
932 //
933 // Note that no line will be created between the previous current point and the
934 // new one.
935 //
936 // Returns TRUE on success
937 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_MoveTo(FPDF_PAGEOBJECT path,
938                                                     float x,
939                                                     float y);
940 
941 // Add a line between the current point and a new point in the path.
942 //
943 // path   - the handle to the path object.
944 // x      - the horizontal position of the new point.
945 // y      - the vertical position of the new point.
946 //
947 // The path's current point is changed to (x, y).
948 //
949 // Returns TRUE on success
950 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_LineTo(FPDF_PAGEOBJECT path,
951                                                     float x,
952                                                     float y);
953 
954 // Add a cubic Bezier curve to the given path, starting at the current point.
955 //
956 // path   - the handle to the path object.
957 // x1     - the horizontal position of the first Bezier control point.
958 // y1     - the vertical position of the first Bezier control point.
959 // x2     - the horizontal position of the second Bezier control point.
960 // y2     - the vertical position of the second Bezier control point.
961 // x3     - the horizontal position of the ending point of the Bezier curve.
962 // y3     - the vertical position of the ending point of the Bezier curve.
963 //
964 // Returns TRUE on success
965 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_BezierTo(FPDF_PAGEOBJECT path,
966                                                       float x1,
967                                                       float y1,
968                                                       float x2,
969                                                       float y2,
970                                                       float x3,
971                                                       float y3);
972 
973 // Close the current subpath of a given path.
974 //
975 // path   - the handle to the path object.
976 //
977 // This will add a line between the current point and the initial point of the
978 // subpath, thus terminating the current subpath.
979 //
980 // Returns TRUE on success
981 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_Close(FPDF_PAGEOBJECT path);
982 
983 // Set the drawing mode of a path.
984 //
985 // path     - the handle to the path object.
986 // fillmode - the filling mode to be set: one of the FPDF_FILLMODE_* flags.
987 // stroke   - a boolean specifying if the path should be stroked or not.
988 //
989 // Returns TRUE on success
990 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path,
991                                                          int fillmode,
992                                                          FPDF_BOOL stroke);
993 
994 // Experimental API.
995 // Get the drawing mode of a path.
996 //
997 // path     - the handle to the path object.
998 // fillmode - the filling mode of the path: one of the FPDF_FILLMODE_* flags.
999 // stroke   - a boolean specifying if the path is stroked or not.
1000 //
1001 // Returns TRUE on success
1002 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path,
1003                                                          int* fillmode,
1004                                                          FPDF_BOOL* stroke);
1005 
1006 // Experimental API.
1007 // Get the transform matrix of a path.
1008 //
1009 //   path   - handle to a path.
1010 //   matrix - pointer to struct to receive the matrix value.
1011 //
1012 // The matrix is composed as:
1013 //   |a c e|
1014 //   |b d f|
1015 // and used to scale, rotate, shear and translate the path.
1016 //
1017 // Returns TRUE on success.
1018 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetMatrix(FPDF_PAGEOBJECT path,
1019                                                        FS_MATRIX* matrix);
1020 
1021 // Experimental API.
1022 // Set the transform matrix of a path.
1023 //
1024 //   path   - handle to a path.
1025 //   matrix - pointer to struct with the matrix value.
1026 //
1027 // The matrix is composed as:
1028 //   |a c e|
1029 //   |b d f|
1030 // and can be used to scale, rotate, shear and translate the path.
1031 //
1032 // Returns TRUE on success.
1033 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetMatrix(FPDF_PAGEOBJECT path,
1034                                                        const FS_MATRIX* matrix);
1035 
1036 // Create a new text object using one of the standard PDF fonts.
1037 //
1038 // document   - handle to the document.
1039 // font       - string containing the font name, without spaces.
1040 // font_size  - the font size for the new text object.
1041 //
1042 // Returns a handle to a new text object, or NULL on failure
1043 FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
1044 FPDFPageObj_NewTextObj(FPDF_DOCUMENT document,
1045                        FPDF_BYTESTRING font,
1046                        float font_size);
1047 
1048 // Set the text for a textobject. If it had text, it will be replaced.
1049 //
1050 // text_object  - handle to the text object.
1051 // text         - the UTF-16LE encoded string containing the text to be added.
1052 //
1053 // Returns TRUE on success
1054 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1055 FPDFText_SetText(FPDF_PAGEOBJECT text_object, FPDF_WIDESTRING text);
1056 
1057 // Returns a font object loaded from a stream of data. The font is loaded
1058 // into the document.
1059 //
1060 // document   - handle to the document.
1061 // data       - the stream of data, which will be copied by the font object.
1062 // size       - size of the stream, in bytes.
1063 // font_type  - FPDF_FONT_TYPE1 or FPDF_FONT_TRUETYPE depending on the font
1064 // type.
1065 // cid        - a boolean specifying if the font is a CID font or not.
1066 //
1067 // The loaded font can be closed using FPDFFont_Close.
1068 //
1069 // Returns NULL on failure
1070 FPDF_EXPORT FPDF_FONT FPDF_CALLCONV FPDFText_LoadFont(FPDF_DOCUMENT document,
1071                                                       const uint8_t* data,
1072                                                       uint32_t size,
1073                                                       int font_type,
1074                                                       FPDF_BOOL cid);
1075 
1076 // Experimental API.
1077 // Loads one of the standard 14 fonts per PDF spec 1.7 page 416. The preferred
1078 // way of using font style is using a dash to separate the name from the style,
1079 // for example 'Helvetica-BoldItalic'.
1080 //
1081 // document   - handle to the document.
1082 // font       - string containing the font name, without spaces.
1083 //
1084 // The loaded font can be closed using FPDFFont_Close.
1085 //
1086 // Returns NULL on failure.
1087 FPDF_EXPORT FPDF_FONT FPDF_CALLCONV
1088 FPDFText_LoadStandardFont(FPDF_DOCUMENT document, FPDF_BYTESTRING font);
1089 
1090 // Experimental API.
1091 // Get the transform matrix of a text object.
1092 //
1093 //   text   - handle to a text.
1094 //   matrix - pointer to struct with the matrix value.
1095 //
1096 // The matrix is composed as:
1097 //   |a c e|
1098 //   |b d f|
1099 // and used to scale, rotate, shear and translate the text.
1100 //
1101 // Returns TRUE on success.
1102 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text,
1103                                                           FS_MATRIX* matrix);
1104 
1105 // Experimental API.
1106 // Get the font size of a text object.
1107 //
1108 //   text - handle to a text.
1109 //
1110 // Returns the font size of the text object, measured in points (about 1/72
1111 // inch) on success; 0 on failure.
1112 FPDF_EXPORT float FPDF_CALLCONV FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text);
1113 
1114 // Close a loaded PDF font.
1115 //
1116 // font   - Handle to the loaded font.
1117 FPDF_EXPORT void FPDF_CALLCONV FPDFFont_Close(FPDF_FONT font);
1118 
1119 // Create a new text object using a loaded font.
1120 //
1121 // document   - handle to the document.
1122 // font       - handle to the font object.
1123 // font_size  - the font size for the new text object.
1124 //
1125 // Returns a handle to a new text object, or NULL on failure
1126 FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
1127 FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
1128                           FPDF_FONT font,
1129                           float font_size);
1130 
1131 // Experimental API.
1132 // Get the text rendering mode of a text object.
1133 //
1134 // text     - the handle to the text object.
1135 //
1136 // Returns one of the known FPDF_TEXT_RENDERMODE enum values on success,
1137 // FPDF_TEXTRENDERMODE_UNKNOWN on error.
1138 FPDF_EXPORT FPDF_TEXT_RENDERMODE FPDF_CALLCONV
1139 FPDFTextObj_GetTextRenderMode(FPDF_PAGEOBJECT text);
1140 
1141 // Experimental API.
1142 // Set the text rendering mode of a text object.
1143 //
1144 // text         - the handle to the text object.
1145 // render_mode  - the FPDF_TEXT_RENDERMODE enum value to be set (cannot set to
1146 //                FPDF_TEXTRENDERMODE_UNKNOWN).
1147 //
1148 // Returns TRUE on success.
1149 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1150 FPDFTextObj_SetTextRenderMode(FPDF_PAGEOBJECT text,
1151                               FPDF_TEXT_RENDERMODE render_mode);
1152 
1153 // Experimental API.
1154 // Get the font name of a text object.
1155 //
1156 // text             - the handle to the text object.
1157 // buffer           - the address of a buffer that receives the font name.
1158 // length           - the size, in bytes, of |buffer|.
1159 //
1160 // Returns the number of bytes in the font name (including the trailing NUL
1161 // character) on success, 0 on error.
1162 //
1163 // Regardless of the platform, the |buffer| is always in UTF-8 encoding.
1164 // If |length| is less than the returned length, or |buffer| is NULL, |buffer|
1165 // will not be modified.
1166 FPDF_EXPORT unsigned long FPDF_CALLCONV
1167 FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text,
1168                         void* buffer,
1169                         unsigned long length);
1170 
1171 // Experimental API.
1172 // Get the text of a text object.
1173 //
1174 // text_object      - the handle to the text object.
1175 // text_page        - the handle to the text page.
1176 // buffer           - the address of a buffer that receives the text.
1177 // length           - the size, in bytes, of |buffer|.
1178 //
1179 // Returns the number of bytes in the text (including the trailing NUL
1180 // character) on success, 0 on error.
1181 //
1182 // Regardless of the platform, the |buffer| is always in UTF-16LE encoding.
1183 // If |length| is less than the returned length, or |buffer| is NULL, |buffer|
1184 // will not be modified.
1185 FPDF_EXPORT unsigned long FPDF_CALLCONV
1186 FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
1187                     FPDF_TEXTPAGE text_page,
1188                     void* buffer,
1189                     unsigned long length);
1190 
1191 // Experimental API.
1192 // Get number of page objects inside |form_object|.
1193 //
1194 //   form_object - handle to a form object.
1195 //
1196 // Returns the number of objects in |form_object| on success, -1 on error.
1197 FPDF_EXPORT int FPDF_CALLCONV
1198 FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object);
1199 
1200 // Experimental API.
1201 // Get page object in |form_object| at |index|.
1202 //
1203 //   form_object - handle to a form object.
1204 //   index       - the 0-based index of a page object.
1205 //
1206 // Returns the handle to the page object, or NULL on error.
1207 FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV
1208 FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index);
1209 
1210 // Experimental API.
1211 // Get the transform matrix of a form object.
1212 //
1213 //   form_object - handle to a form.
1214 //   matrix      - pointer to struct to receive the matrix value.
1215 //
1216 // The matrix is composed as:
1217 //   |a c e|
1218 //   |b d f|
1219 // and used to scale, rotate, shear and translate the form object.
1220 //
1221 // Returns TRUE on success.
1222 FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
1223 FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object, FS_MATRIX* matrix);
1224 
1225 #ifdef __cplusplus
1226 }  // extern "C"
1227 #endif  // __cplusplus
1228 
1229 #endif  // PUBLIC_FPDF_EDIT_H_
1230