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.
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
11 #if defined(_WIN32) && !defined(__WINDOWS__)
15 // TODO: remove the #define when XFA is officially in pdfium
19 typedef void* FPDF_MODULEMGR;
22 typedef void* FPDF_DOCUMENT;
23 typedef void* FPDF_PAGE;
24 typedef void* FPDF_WIDGET;
25 typedef void* FPDF_STRINGHANDLE;
26 typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc)
27 typedef void* FPDF_PATH;
28 typedef void* FPDF_CLIPPATH;
29 typedef void* FPDF_BITMAP;
30 typedef void* FPDF_FONT;
32 typedef void* FPDF_TEXTPAGE;
33 typedef void* FPDF_SCHHANDLE;
34 typedef void* FPDF_PAGELINK;
35 typedef void* FPDF_HMODULE;
36 typedef void* FPDF_DOCSCHHANDLE;
38 typedef void* FPDF_BOOKMARK;
39 typedef void* FPDF_DEST;
40 typedef void* FPDF_ACTION;
41 typedef void* FPDF_LINK;
42 typedef void* FPDF_PAGERANGE;
45 typedef void* FPDF_LPVOID;
46 typedef void const* FPDF_LPCVOID;
47 typedef int FPDF_RESULT;
48 typedef int FPDF_BOOL;
49 typedef int FPDF_ERROR;
50 typedef unsigned long FPDF_DWORD;
52 typedef float FS_FLOAT;
55 typedef enum _FPDF_DUPLEXTYPE_ {
63 typedef unsigned short FPDF_WCHAR;
64 typedef unsigned char const* FPDF_LPCBYTE;
65 typedef char const* FPDF_LPCSTR;
67 // FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE encoded), and platform dependent string
68 typedef const char* FPDF_BYTESTRING;
70 typedef const unsigned short* FPDF_WIDESTRING; // Foxit PDF SDK always use UTF-16LE encoding wide string,
71 // each character use 2 bytes (except surrogation), with low byte first.
73 #ifndef _FPDF_DEF_STR_
74 #define _FPDF_DEF_STR_
75 /** @brief Structure for byte string.
77 * @note In SDK, a byte string commonly means a UTF-16LE format string.
79 typedef struct _FPDF_BSTR
82 * @brief String buffer.
86 * @brief Length of a string, in bytes.
93 // For Windows programmers: for most case it's OK to treat FPDF_WIDESTRING as Windows unicode string,
94 // however, special care needs to be taken if you expect to process Unicode larger than 0xffff.
95 // For Linux/Unix programmers: most compiler/library environment uses 4 bytes for a Unicode character,
96 // you have to convert between FPDF_WIDESTRING and system wide string by yourself.
99 typedef const unsigned short* FPDF_STRING;
101 typedef const char* FPDF_STRING;
104 #ifndef _FS_DEF_MATRIX_
105 #define _FS_DEF_MATRIX_
106 /** @brief Matrix for transformation. */
107 typedef struct _FS_MATRIX_
109 float a; /**< @brief Coefficient a.*/
110 float b; /**< @brief Coefficient b.*/
111 float c; /**< @brief Coefficient c.*/
112 float d; /**< @brief Coefficient d.*/
113 float e; /**< @brief Coefficient e.*/
114 float f; /**< @brief Coefficient f.*/
118 #ifndef _FS_DEF_RECTF_
119 #define _FS_DEF_RECTF_
120 /** @brief Rectangle area(float) in device or page coordination system. */
121 typedef struct _FS_RECTF_
124 /** @brief The x-coordinate of the left-top corner. */
126 /** @brief The y-coordinate of the left-top corner. */
128 /** @brief The x-coordinate of the right-bottom corner. */
130 /** @brief The y-coordinate of the right-bottom corner. */
133 }* FS_LPRECTF, FS_RECTF;
134 /** @brief Const Pointer to ::FS_RECTF structure.*/
135 typedef const FS_RECTF* FS_LPCRECTF;
138 #if defined(_WIN32) && defined(FPDFSDK_EXPORTS)
139 // On Windows system, functions are exported in a DLL
140 #define DLLEXPORT __declspec( dllexport )
141 #define STDCALL __stdcall
147 extern const char g_ExpireDate[];
148 extern const char g_ModuleCodes[];
150 // Exported Functions
155 // Function: FPDF_InitLibrary
156 // Initialize the FPDFSDK library
162 // You have to call this function before you can call any PDF processing functions.
164 DLLEXPORT void STDCALL FPDF_InitLibrary();
167 // Function: FPDF_DestroyLibary
168 // Release all resources allocated by the FPDFSDK library.
174 // You can call this function to release all memory blocks allocated by the library.
175 // After this function called, you should not call any PDF processing functions.
176 DLLEXPORT void STDCALL FPDF_DestroyLibrary();
178 //Policy for accessing the local machine time.
179 #define FPDF_POLICY_MACHINETIME_ACCESS 0
181 // Function: FPDF_SetSandBoxPolicy
182 // Set the policy for the sandbox environment.
184 // policy - The specified policy for setting, for example:FPDF_POLICY_MACHINETIME_ACCESS.
185 // enable - True for enable, False for disable the policy.
188 DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
191 * Open and load a PDF document.
192 * @param[in] file_path - Path to the PDF file (including extension).
193 * @param[in] password - A string used as the password for PDF file.
194 * If no password needed, empty or NULL can be used.
195 * @note Loaded document can be closed by FPDF_CloseDocument.
196 * If this function fails, you can use FPDF_GetLastError() to retrieve
197 * the reason why it fails.
198 * The application should call ::FPDF_LoadXFA function after PDF document loaded
199 * to support XFA fields in fpdfformfill.h file.
201 * @retval A handle to the loaded document. If failed, NULL is returned.
203 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path,
204 FPDF_BYTESTRING password);
206 // Function: FPDF_LoadMemDocument
207 // Open and load a PDF document from memory.
209 // data_buf - Pointer to a buffer containing the PDF document.
210 // size - Number of bytes in the PDF document.
211 // password - A string used as the password for PDF file.
212 // If no password needed, empty or NULL can be used.
214 // A handle to the loaded document. If failed, NULL is returned.
216 // The memory buffer must remain valid when the document is open.
217 // Loaded document can be closed by FPDF_CloseDocument.
218 // If this function fails, you can use FPDF_GetLastError() to retrieve
219 // the reason why it fails.
221 // The application should call ::FPDF_LoadXFA function after PDF document loaded
222 // to support XFA fields in fpdfformfill.h file.
224 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf,
225 int size, FPDF_BYTESTRING password);
227 // Structure for custom file access.
229 // File length, in bytes.
230 unsigned long m_FileLen;
232 // A function pointer for getting a block of data from specific position.
233 // Position is specified by byte offset from beginning of the file.
234 // The position and size will never go out range of file length.
235 // It may be possible for FPDFSDK to call this function multiple times for same position.
236 // Return value: should be non-zero if successful, zero for error.
237 int (*m_GetBlock)(void* param, unsigned long position, unsigned char* pBuf, unsigned long size);
239 // A custom pointer for all implementation specific data.
240 // This pointer will be used as the first parameter to m_GetBlock callback.
245 * @brief Structure for file reading or writing (I/O).
247 * @note This is a handler and should be implemented by callers.
249 typedef struct _FPDF_FILEHANDLER
252 * @brief User-defined data.
253 * @note Callers can use this field to track controls.
255 FPDF_LPVOID clientData;
257 * @brief Callback function to release the current file stream object.
259 * @param[in] clientData Pointer to user-defined data.
263 void (*Release)(FPDF_LPVOID clientData);
265 * @brief Callback function to retrieve the current file stream size.
267 * @param[in] clientData Pointer to user-defined data.
269 * @return Size of file stream.
271 FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData);
273 * @brief Callback function to read data from the current file stream.
275 * @param[in] clientData Pointer to user-defined data.
276 * @param[in] offset Offset position starts from the beginning of file stream. This parameter indicates reading position.
277 * @param[in] buffer Memory buffer to store data which are read from file stream. This parameter should not be <b>NULL</b>.
278 * @param[in] size Size of data which should be read from file stream, in bytes. The buffer indicated by the parameter <i>buffer</i> should be enough to store specified data.
280 * @return 0 for success, other value for failure.
282 FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPVOID buffer, FPDF_DWORD size);
284 * @brief Callback function to write data into the current file stream.
286 * @param[in] clientData Pointer to user-defined data.
287 * @param[in] offset Offset position starts from the beginning of file stream. This parameter indicates writing position.
288 * @param[in] buffer Memory buffer contains data which is written into file stream. This parameter should not be <b>NULL</b>.
289 * @param[in] size Size of data which should be written into file stream, in bytes.
291 * @return 0 for success, other value for failure.
293 FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPCVOID buffer, FPDF_DWORD size);
295 * @brief Callback function to flush all internal accessing buffers.
297 * @param[in] clientData Pointer to user-defined data.
299 * @return 0 for success, other value for failure.
301 FPDF_RESULT (*Flush)(FPDF_LPVOID clientData);
303 * @brief Callback function to change file size.
305 * @details This function is called under writing mode usually. Implementer can determine whether to realize it based on application requests.
307 * @param[in] clientData Pointer to user-defined data.
308 * @param[in] size New size of file stream, in bytes.
310 * @return 0 for success, other value for failure.
312 FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size);
314 } FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER;
316 // Function: FPDF_LoadCustomDocument
317 // Load PDF document from a custom access descriptor.
319 // pFileAccess - A structure for access the file.
320 // password - Optional password for decrypting the PDF file.
322 // A handle to the loaded document. If failed, NULL is returned.
324 // The application should maintain the file resources being valid until the PDF document close.
325 // Loaded document can be closed by FPDF_CloseDocument.
327 // The application should call ::FPDF_LoadXFA function after PDF document loaded
328 // to support XFA fields in fpdfformfill.h file.
330 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess,
331 FPDF_BYTESTRING password);
333 // Function: FPDF_GetFileVersion
334 // Get the file version of the specific PDF document.
336 // doc - Handle to document.
337 // fileVersion - The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...
339 // TRUE if this call succeed, If failed, FALSE is returned.
341 // If the document is created by function ::FPDF_CreateNewDocument, then this function would always fail.
343 DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, int* fileVersion);
345 #define FPDF_ERR_SUCCESS 0 // No error.
346 #define FPDF_ERR_UNKNOWN 1 // Unknown error.
347 #define FPDF_ERR_FILE 2 // File not found or could not be opened.
348 #define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted.
349 #define FPDF_ERR_PASSWORD 4 // Password required or incorrect password.
350 #define FPDF_ERR_SECURITY 5 // Unsupported security scheme.
351 #define FPDF_ERR_PAGE 6 // Page not found or content error.
352 #define FPDF_ERR_XFALOAD 7 // Load XFA error.
353 #define FPDF_ERR_XFALAYOUT 8 // Layout XFA error.
355 // Function: FPDF_GetLastError
356 // Get last error code when an SDK function failed.
360 // A 32-bit integer indicating error codes (defined above).
362 // If the previous SDK call succeeded, the return value of this function
365 DLLEXPORT unsigned long STDCALL FPDF_GetLastError();
367 // Function: FPDF_GetDocPermission
368 // Get file permission flags of the document.
370 // document - Handle to document. Returned by FPDF_LoadDocument function.
372 // A 32-bit integer indicating permission flags. Please refer to PDF Reference for
373 // detailed description. If the document is not protected, 0xffffffff will be returned.
375 DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document);
377 // Function: FPDF_GetSecurityHandlerRevision
378 // Get the revision for security handler.
380 // document - Handle to document. Returned by FPDF_LoadDocument function.
382 // The security handler revision number. Please refer to PDF Reference for
383 // detailed description. If the document is not protected, -1 will be returned.
385 DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document);
387 // Function: FPDF_GetPageCount
388 // Get total number of pages in a document.
390 // document - Handle to document. Returned by FPDF_LoadDocument function.
392 // Total number of pages in the document.
394 DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document);
396 // Function: FPDF_LoadPage
397 // Load a page inside a document.
399 // document - Handle to document. Returned by FPDF_LoadDocument function.
400 // page_index - Index number of the page. 0 for the first page.
402 // A handle to the loaded page. If failed, NULL is returned.
404 // Loaded page can be rendered to devices using FPDF_RenderPage function.
405 // Loaded page can be closed by FPDF_ClosePage.
407 DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, int page_index);
409 // Function: FPDF_GetPageWidth
412 // page - Handle to the page. Returned by FPDF_LoadPage function.
414 // Page width (excluding non-displayable area) measured in points.
415 // One point is 1/72 inch (around 0.3528 mm).
417 DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page);
419 // Function: FPDF_GetPageHeight
422 // page - Handle to the page. Returned by FPDF_LoadPage function.
424 // Page height (excluding non-displayable area) measured in points.
425 // One point is 1/72 inch (around 0.3528 mm)
427 DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page);
429 // Function: FPDF_GetPageSizeByIndex
430 // Get the size of a page by index.
432 // document - Handle to document. Returned by FPDF_LoadDocument function.
433 // page_index - Page index, zero for the first page.
434 // width - Pointer to a double value receiving the page width (in points).
435 // height - Pointer to a double value receiving the page height (in points).
437 // Non-zero for success. 0 for error (document or page not found).
439 DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_index, double* width, double* height);
442 // Page rendering flags. They can be combined with bit OR.
443 #define FPDF_ANNOT 0x01 // Set if annotations are to be rendered.
444 #define FPDF_LCD_TEXT 0x02 // Set if using text rendering optimized for LCD display.
445 #define FPDF_NO_NATIVETEXT 0x04 // Don't use the native text output available on some platforms
446 #define FPDF_GRAYSCALE 0x08 // Grayscale output.
447 #define FPDF_DEBUG_INFO 0x80 // Set if you want to get some debug info.
448 // Please discuss with Foxit first if you need to collect debug info.
449 #define FPDF_NO_CATCH 0x100 // Set if you don't want to catch exception.
450 #define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 // Limit image cache size.
451 #define FPDF_RENDER_FORCEHALFTONE 0x400 // Always use halftone for image stretching.
452 #define FPDF_PRINTING 0x800 // Render for printing.
453 #define FPDF_REVERSE_BYTE_ORDER 0x10 //set whether render in a reverse Byte order, this flag only
454 //enable when render to a bitmap.
456 // Function: FPDF_RenderPage
457 // Render contents in a page to a device (screen, bitmap, or printer).
458 // This function is only supported on Windows system.
460 // dc - Handle to device context.
461 // page - Handle to the page. Returned by FPDF_LoadPage function.
462 // start_x - Left pixel position of the display area in the device coordinate.
463 // start_y - Top pixel position of the display area in the device coordinate.
464 // size_x - Horizontal size (in pixels) for displaying the page.
465 // size_y - Vertical size (in pixels) for displaying the page.
466 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
467 // 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
468 // flags - 0 for normal display, or combination of flags defined above.
472 // The method can not support to render the page for the document consists of dynamic XFA fields.
474 DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
475 int rotate, int flags);
478 // Function: FPDF_RenderPageBitmap
479 // Render contents in a page to a device independent bitmap
481 // bitmap - Handle to the device independent bitmap (as the output buffer).
482 // Bitmap handle can be created by FPDFBitmap_Create function.
483 // page - Handle to the page. Returned by FPDF_LoadPage function.
484 // start_x - Left pixel position of the display area in the bitmap coordinate.
485 // start_y - Top pixel position of the display area in the bitmap coordinate.
486 // size_x - Horizontal size (in pixels) for displaying the page.
487 // size_y - Vertical size (in pixels) for displaying the page.
488 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
489 // 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
490 // flags - 0 for normal display, or combination of flags defined above.
494 // The method can not support to render the page for the document consists of dynamic XFA fields.
496 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y,
497 int size_x, int size_y, int rotate, int flags);
499 // Function: FPDF_ClosePage
500 // Close a loaded PDF page.
502 // page - Handle to the loaded page.
506 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);
508 // Function: FPDF_CloseDocument
509 // Close a loaded PDF document.
511 // document - Handle to the loaded document.
515 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
517 // Function: FPDF_DeviceToPage
518 // Convert the screen coordinate of a point to page coordinate.
520 // page - Handle to the page. Returned by FPDF_LoadPage function.
521 // start_x - Left pixel position of the display area in the device coordinate.
522 // start_y - Top pixel position of the display area in the device coordinate.
523 // size_x - Horizontal size (in pixels) for displaying the page.
524 // size_y - Vertical size (in pixels) for displaying the page.
525 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
526 // 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
527 // device_x - X value in device coordinate, for the point to be converted.
528 // device_y - Y value in device coordinate, for the point to be converted.
529 // page_x - A Pointer to a double receiving the converted X value in page coordinate.
530 // page_y - A Pointer to a double receiving the converted Y value in page coordinate.
534 // The page coordinate system has its origin at left-bottom corner of the page, with X axis goes along
535 // the bottom side to the right, and Y axis goes along the left side upward. NOTE: this coordinate system
536 // can be altered when you zoom, scroll, or rotate a page, however, a point on the page should always have
537 // the same coordinate values in the page coordinate system.
539 // The device coordinate system is device dependent. For screen device, its origin is at left-top
540 // corner of the window. However this origin can be altered by Windows coordinate transformation
541 // utilities. You must make sure the start_x, start_y, size_x, size_y and rotate parameters have exactly
542 // same values as you used in FPDF_RenderPage() function call.
544 DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
545 int rotate, int device_x, int device_y, double* page_x, double* page_y);
547 // Function: FPDF_PageToDevice
548 // Convert the page coordinate of a point to screen coordinate.
550 // page - Handle to the page. Returned by FPDF_LoadPage function.
551 // start_x - Left pixel position of the display area in the device coordinate.
552 // start_y - Top pixel position of the display area in the device coordinate.
553 // size_x - Horizontal size (in pixels) for displaying the page.
554 // size_y - Vertical size (in pixels) for displaying the page.
555 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
556 // 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
557 // page_x - X value in page coordinate, for the point to be converted.
558 // page_y - Y value in page coordinate, for the point to be converted.
559 // device_x - A pointer to an integer receiving the result X value in device coordinate.
560 // device_y - A pointer to an integer receiving the result Y value in device coordinate.
564 // See comments of FPDF_DeviceToPage() function.
566 DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
567 int rotate, double page_x, double page_y, int* device_x, int* device_y);
569 // Function: FPDFBitmap_Create
570 // Create a Foxit Device Independent Bitmap (FXDIB).
572 // width - Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
573 // height - Number of pixels in a vertical line of the bitmap. Must be greater than 0.
574 // alpha - A flag indicating whether alpha channel is used. Non-zero for using alpha, zero for not using.
576 // The created bitmap handle, or NULL if parameter error or out of memory.
578 // An FXDIB always use 4 byte per pixel. The first byte of a pixel is always double word aligned.
579 // Each pixel contains red (R), green (G), blue (B) and optionally alpha (A) values.
580 // The byte order is BGRx (the last byte unused if no alpha channel) or BGRA.
582 // The pixels in a horizontal line (also called scan line) are stored side by side, with left most
583 // pixel stored first (with lower memory address). Each scan line uses width*4 bytes.
585 // Scan lines are stored one after another, with top most scan line stored first. There is no gap
586 // between adjacent scan lines.
588 // This function allocates enough memory for holding all pixels in the bitmap, but it doesn't
589 // initialize the buffer. Applications can use FPDFBitmap_FillRect to fill the bitmap using any color.
590 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha);
593 #define FPDFBitmap_Gray 1 // Gray scale bitmap, one byte per pixel.
594 #define FPDFBitmap_BGR 2 // 3 bytes per pixel, byte order: blue, green, red.
595 #define FPDFBitmap_BGRx 3 // 4 bytes per pixel, byte order: blue, green, red, unused.
596 #define FPDFBitmap_BGRA 4 // 4 bytes per pixel, byte order: blue, green, red, alpha.
598 // Function: FPDFBitmap_CreateEx
599 // Create a Foxit Device Independent Bitmap (FXDIB)
601 // width - Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
602 // height - Number of pixels in a vertical line of the bitmap. Must be greater than 0.
603 // format - A number indicating for bitmap format, as defined above.
604 // first_scan - A pointer to the first byte of first scan line, for external buffer
605 // only. If this parameter is NULL, then the SDK will create its own buffer.
606 // stride - Number of bytes for each scan line, for external buffer only..
608 // The created bitmap handle, or NULL if parameter error or out of memory.
610 // Similar to FPDFBitmap_Create function, with more formats and external buffer supported.
611 // Bitmap created by this function can be used in any place that a FPDF_BITMAP handle is
614 // If external scanline buffer is used, then the application should destroy the buffer
615 // by itself. FPDFBitmap_Destroy function will not destroy the buffer.
617 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int format, void* first_scan, int stride);
619 // Function: FPDFBitmap_FillRect
620 // Fill a rectangle area in an FXDIB.
622 // bitmap - The handle to the bitmap. Returned by FPDFBitmap_Create function.
623 // left - The left side position. Starting from 0 at the left-most pixel.
624 // top - The top side position. Starting from 0 at the top-most scan line.
625 // width - Number of pixels to be filled in each scan line.
626 // height - Number of scan lines to be filled.
627 // color - A 32-bit value specifing the color, in 8888 ARGB format.
631 // This function set the color and (optionally) alpha value in specified region of the bitmap.
632 // NOTE: If alpha channel is used, this function does NOT composite the background with the source color,
633 // instead the background will be replaced by the source color and alpha.
634 // If alpha channel is not used, the "alpha" parameter is ignored.
636 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, FPDF_DWORD color);
638 // Function: FPDFBitmap_GetBuffer
639 // Get data buffer of an FXDIB
641 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
643 // The pointer to the first byte of the bitmap buffer.
645 // The stride may be more than width * number of bytes per pixel
646 // Applications can use this function to get the bitmap buffer pointer, then manipulate any color
647 // and/or alpha values for any pixels in the bitmap.
648 DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
650 // Function: FPDFBitmap_GetWidth
651 // Get width of an FXDIB.
653 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
655 // The number of pixels in a horizontal line of the bitmap.
656 DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);
658 // Function: FPDFBitmap_GetHeight
659 // Get height of an FXDIB.
661 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
663 // The number of pixels in a vertical line of the bitmap.
664 DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);
666 // Function: FPDFBitmap_GetStride
667 // Get number of bytes for each scan line in the bitmap buffer.
669 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
671 // The number of bytes for each scan line in the bitmap buffer.
673 // The stride may be more than width * number of bytes per pixel
674 DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap);
676 // Function: FPDFBitmap_Destroy
677 // Destroy an FXDIB and release all related buffers.
679 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
683 // This function will not destroy any external buffer.
685 DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap);
687 // Function: FPDF_VIEWERREF_GetPrintScaling
688 // Whether the PDF document prefers to be scaled or not.
690 // document - Handle to the loaded document.
694 DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
696 // Function: FPDF_VIEWERREF_GetNumCopies
697 // Returns the number of copies to be printed.
699 // document - Handle to the loaded document.
701 // The number of copies to be printed.
703 DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document);
705 // Function: FPDF_VIEWERREF_GetPrintPageRange
706 // Page numbers to initialize print dialog box when file is printed.
708 // document - Handle to the loaded document.
710 // The print page range to be used for printing.
712 DLLEXPORT FPDF_PAGERANGE STDCALL FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document);
714 // Function: FPDF_VIEWERREF_GetDuplex
715 // Returns the paper handling option to be used when printing from print dialog.
717 // document - Handle to the loaded document.
719 // The paper handling option to be used when printing.
721 DLLEXPORT FPDF_DUPLEXTYPE STDCALL FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
723 // Function: FPDF_CountNamedDests
724 // Get the count of named destinations in the PDF document.
726 // document - Handle to a document
728 // The count of named destinations.
729 DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document);
731 // Function: FPDF_GetNamedDestByName
732 // get a special dest handle by the index.
734 // document - Handle to the loaded document.
735 // name - The name of a special named dest.
737 // The handle of the dest.
739 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_BYTESTRING name);
741 // Function: FPDF_GetNamedDest
742 // Get the specified named destinations of the PDF document by index.
744 // document - Handle to a document
745 // index - The index of named destination.
746 // buffer - The buffer to obtain destination name, used as wchar_t*.
747 // buflen [in/out] - Size of the buffer in bytes on input, length of the result in bytes on output or -1 if the buffer is too small.
749 // The destination handle of a named destination, or NULL if no named destination corresponding to |index|.
751 // Call this function twice to get the name of the named destination:
752 // 1) First time pass in |buffer| as NULL and get buflen.
753 // 2) Second time pass in allocated |buffer| and buflen to retrieve |buffer|, which should be used as wchar_t*.
754 // If buflen is not sufficiently large, it will be set to -1 upon return.
756 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index, void* buffer, long& buflen);
758 // Function: FPDF_BStr_Init
759 // Helper function to initialize a byte string.
760 DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str);
762 // Function: FPDF_BStr_Set
763 // Helper function to set string data.
764 DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, FPDF_LPCSTR bstr, int length);
766 // Function: FPDF_BStr_Clear
767 // Helper function to clear a byte string.
768 DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str);
774 #endif // _FPDFVIEW_H_