John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 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. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Tom Sepez | 1ed8a21 | 2015-05-11 15:25:39 -0700 | [diff] [blame] | 7 | // NOTE: External docs refer to this file as "fpdfview.h", so do not rename |
| 8 | // despite lack of consitency with other public files. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 10 | #ifndef PUBLIC_FPDFVIEW_H_ |
| 11 | #define PUBLIC_FPDFVIEW_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 12 | |
| 13 | #if defined(_WIN32) && !defined(__WINDOWS__) |
| 14 | #include <windows.h> |
| 15 | #endif |
| 16 | |
Bo Xu | bb5ef88 | 2014-11-06 16:13:33 -0800 | [diff] [blame] | 17 | // TODO: remove the #define when XFA is officially in pdfium |
| 18 | #define PDF_USE_XFA |
| 19 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 20 | // Data types |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 21 | typedef void* FPDF_MODULEMGR; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 22 | |
| 23 | // PDF types |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 24 | typedef void* FPDF_DOCUMENT; |
| 25 | typedef void* FPDF_PAGE; |
| 26 | typedef void* FPDF_WIDGET; |
| 27 | typedef void* FPDF_STRINGHANDLE; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 28 | typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc) |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 29 | typedef void* FPDF_PATH; |
| 30 | typedef void* FPDF_CLIPPATH; |
| 31 | typedef void* FPDF_BITMAP; |
| 32 | typedef void* FPDF_FONT; |
| 33 | typedef void* FPDF_TEXTPAGE; |
| 34 | typedef void* FPDF_SCHHANDLE; |
| 35 | typedef void* FPDF_PAGELINK; |
| 36 | typedef void* FPDF_HMODULE; |
| 37 | 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; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 43 | |
| 44 | // Basic data types |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 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; |
| 51 | typedef float FS_FLOAT; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 52 | |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 53 | // Duplex types |
| 54 | typedef enum _FPDF_DUPLEXTYPE_ { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 55 | DuplexUndefined = 0, |
| 56 | Simplex, |
| 57 | DuplexFlipShortEdge, |
| 58 | DuplexFlipLongEdge |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 59 | } FPDF_DUPLEXTYPE; |
| 60 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 61 | // String types |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 62 | typedef unsigned short FPDF_WCHAR; |
| 63 | typedef unsigned char const* FPDF_LPCBYTE; |
| 64 | typedef char const* FPDF_LPCSTR; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 65 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 66 | // FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE |
| 67 | // encoded), and platform dependent string |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 68 | typedef const char* FPDF_BYTESTRING; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 69 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 70 | typedef const unsigned short* |
| 71 | FPDF_WIDESTRING; // Foxit PDF SDK always use UTF-16LE encoding wide string, |
| 72 | // each character use 2 bytes (except surrogation), with low byte first. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 73 | |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 74 | #ifndef _FPDF_DEF_STR_ |
| 75 | #define _FPDF_DEF_STR_ |
| 76 | /** @brief Structure for byte string. |
| 77 | * |
| 78 | * @note In SDK, a byte string commonly means a UTF-16LE format string. |
| 79 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 80 | typedef struct _FPDF_BSTR { |
| 81 | /** |
| 82 | * @brief String buffer. |
| 83 | */ |
| 84 | char* str; |
| 85 | /** |
| 86 | * @brief Length of a string, in bytes. |
| 87 | */ |
| 88 | int len; |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 89 | } FPDF_BSTR; |
| 90 | |
| 91 | #endif |
| 92 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 93 | // For Windows programmers: for most case it's OK to treat FPDF_WIDESTRING as |
| 94 | // Windows unicode string, |
| 95 | // however, special care needs to be taken if you expect to process |
| 96 | // Unicode larger than 0xffff. |
| 97 | // For Linux/Unix programmers: most compiler/library environment uses 4 bytes |
| 98 | // for a Unicode character, |
| 99 | // you have to convert between FPDF_WIDESTRING and system wide string by |
| 100 | // yourself. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 101 | |
| 102 | #ifdef _WIN32_WCE |
| 103 | typedef const unsigned short* FPDF_STRING; |
| 104 | #else |
| 105 | typedef const char* FPDF_STRING; |
| 106 | #endif |
| 107 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 108 | /** @brief Matrix for transformation. */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 109 | typedef struct _FS_MATRIX_ { |
| 110 | float a; /**< @brief Coefficient a.*/ |
| 111 | float b; /**< @brief Coefficient b.*/ |
| 112 | float c; /**< @brief Coefficient c.*/ |
| 113 | float d; /**< @brief Coefficient d.*/ |
| 114 | float e; /**< @brief Coefficient e.*/ |
| 115 | float f; /**< @brief Coefficient f.*/ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 116 | } FS_MATRIX; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 117 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 118 | /** @brief Rectangle area(float) in device or page coordination system. */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 119 | typedef struct _FS_RECTF_ { |
| 120 | /**@{*/ |
| 121 | /** @brief The x-coordinate of the left-top corner. */ |
| 122 | float left; |
| 123 | /** @brief The y-coordinate of the left-top corner. */ |
| 124 | float top; |
| 125 | /** @brief The x-coordinate of the right-bottom corner. */ |
| 126 | float right; |
| 127 | /** @brief The y-coordinate of the right-bottom corner. */ |
| 128 | float bottom; |
| 129 | /**@}*/ |
| 130 | } * FS_LPRECTF, FS_RECTF; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 131 | /** @brief Const Pointer to ::FS_RECTF structure.*/ |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 132 | typedef const FS_RECTF* FS_LPCRECTF; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 133 | |
| 134 | #if defined(_WIN32) && defined(FPDFSDK_EXPORTS) |
| 135 | // On Windows system, functions are exported in a DLL |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 136 | #define DLLEXPORT __declspec(dllexport) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 137 | #define STDCALL __stdcall |
| 138 | #else |
| 139 | #define DLLEXPORT |
| 140 | #define STDCALL |
| 141 | #endif |
| 142 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 143 | // Exported Functions |
| 144 | #ifdef __cplusplus |
| 145 | extern "C" { |
| 146 | #endif |
| 147 | |
| 148 | // Function: FPDF_InitLibrary |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 149 | // Initialize the FPDFSDK library |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 150 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 151 | // None |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 152 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 153 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 154 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 155 | // You have to call this function before you can call any PDF |
| 156 | // processing functions. |
John Abd-El-Malek | 207299b | 2014-12-15 12:13:45 -0800 | [diff] [blame] | 157 | DLLEXPORT void STDCALL FPDF_InitLibrary(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 158 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 159 | // Function: FPDF_DestroyLibary |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 160 | // Release all resources allocated by the FPDFSDK library. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 161 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 162 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 163 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 164 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 165 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 166 | // You can call this function to release all memory blocks allocated by |
| 167 | // the library. |
| 168 | // After this function called, you should not call any PDF processing |
| 169 | // functions. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 170 | DLLEXPORT void STDCALL FPDF_DestroyLibrary(); |
| 171 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 172 | // Policy for accessing the local machine time. |
| 173 | #define FPDF_POLICY_MACHINETIME_ACCESS 0 |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 174 | |
| 175 | // Function: FPDF_SetSandBoxPolicy |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 176 | // Set the policy for the sandbox environment. |
| 177 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 178 | // policy - The specified policy for setting, for |
| 179 | // example:FPDF_POLICY_MACHINETIME_ACCESS. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 180 | // enable - True for enable, False for disable the policy. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 181 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 182 | // None. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 183 | DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, |
| 184 | FPDF_BOOL enable); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 185 | |
Tom Sepez | 3c3201f | 2015-05-20 10:20:35 -0700 | [diff] [blame] | 186 | // Function: FPDF_LoadDocument |
| 187 | // Open and load a PDF document. |
| 188 | // Parameters: |
| 189 | // file_path [in] - Path to the PDF file (including extension). |
| 190 | // password [in] - A string used as the password for PDF file. |
| 191 | // If no password needed, empty or NULL can be used. |
| 192 | // Return value: |
| 193 | // A handle to the loaded document, or NULL on failure. |
| 194 | // Comments: |
| 195 | // 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 failed. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 198 | // The application should call ::FPDF_LoadXFA function after PDF |
| 199 | // document loaded |
Tom Sepez | 3c3201f | 2015-05-20 10:20:35 -0700 | [diff] [blame] | 200 | // to support XFA fields in fpdfformfill.h file. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 201 | DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 202 | FPDF_BYTESTRING password); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 203 | |
| 204 | // Function: FPDF_LoadMemDocument |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 205 | // Open and load a PDF document from memory. |
| 206 | // Parameters: |
| 207 | // data_buf - Pointer to a buffer containing the PDF document. |
| 208 | // size - Number of bytes in the PDF document. |
| 209 | // password - A string used as the password for PDF file. |
| 210 | // If no password needed, empty or NULL can be used. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 211 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 212 | // A handle to the loaded document. If failed, NULL is returned. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 213 | // Comments: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 214 | // The memory buffer must remain valid when the document is open. |
| 215 | // Loaded document can be closed by FPDF_CloseDocument. |
| 216 | // If this function fails, you can use FPDF_GetLastError() to retrieve |
| 217 | // the reason why it fails. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 218 | // Notes: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 219 | // The application should call ::FPDF_LoadXFA function after PDF |
| 220 | // document loaded |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 221 | // to support XFA fields in fpdfformfill.h file. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 222 | // |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 223 | DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 224 | int size, |
| 225 | FPDF_BYTESTRING password); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 226 | |
| 227 | // Structure for custom file access. |
| 228 | typedef struct { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 229 | // File length, in bytes. |
| 230 | unsigned long m_FileLen; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 231 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 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 |
| 236 | // same position. |
| 237 | // Return value: should be non-zero if successful, zero for error. |
| 238 | int (*m_GetBlock)(void* param, |
| 239 | unsigned long position, |
| 240 | unsigned char* pBuf, |
| 241 | unsigned long size); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 242 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 243 | // A custom pointer for all implementation specific data. |
| 244 | // This pointer will be used as the first parameter to m_GetBlock callback. |
| 245 | void* m_Param; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 246 | } FPDF_FILEACCESS; |
| 247 | |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 248 | /** |
| 249 | * @brief Structure for file reading or writing (I/O). |
| 250 | * |
| 251 | * @note This is a handler and should be implemented by callers. |
| 252 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 253 | typedef struct _FPDF_FILEHANDLER { |
| 254 | /** |
| 255 | * @brief User-defined data. |
| 256 | * @note Callers can use this field to track controls. |
| 257 | */ |
| 258 | FPDF_LPVOID clientData; |
| 259 | /** |
| 260 | * @brief Callback function to release the current file stream object. |
| 261 | * |
| 262 | * @param[in] clientData Pointer to user-defined data. |
| 263 | * |
| 264 | * @return None. |
| 265 | */ |
| 266 | void (*Release)(FPDF_LPVOID clientData); |
| 267 | /** |
| 268 | * @brief Callback function to retrieve the current file stream size. |
| 269 | * |
| 270 | * @param[in] clientData Pointer to user-defined data. |
| 271 | * |
| 272 | * @return Size of file stream. |
| 273 | */ |
| 274 | FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData); |
| 275 | /** |
| 276 | * @brief Callback function to read data from the current file stream. |
| 277 | * |
| 278 | * @param[in] clientData Pointer to user-defined data. |
| 279 | * @param[in] offset Offset position starts from the beginning of file |
| 280 | * stream. This parameter indicates reading position. |
| 281 | * @param[in] buffer Memory buffer to store data which are read from |
| 282 | * file stream. This parameter should not be <b>NULL</b>. |
| 283 | * @param[in] size Size of data which should be read from file |
| 284 | * stream, in bytes. The buffer indicated by the parameter <i>buffer</i> |
| 285 | * should be enough to store specified data. |
| 286 | * |
| 287 | * @return 0 for success, other value for failure. |
| 288 | */ |
| 289 | FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPVOID buffer, FPDF_DWORD size); |
| 290 | /** |
| 291 | * @brief Callback function to write data into the current file stream. |
| 292 | * |
| 293 | * @param[in] clientData Pointer to user-defined data. |
| 294 | * @param[in] offset Offset position starts from the beginning of file |
| 295 | * stream. This parameter indicates writing position. |
| 296 | * @param[in] buffer Memory buffer contains data which is written into |
| 297 | * file stream. This parameter should not be <b>NULL</b>. |
| 298 | * @param[in] size Size of data which should be written into file |
| 299 | * stream, in bytes. |
| 300 | * |
| 301 | * @return 0 for success, other value for failure. |
| 302 | */ |
| 303 | FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPCVOID buffer, FPDF_DWORD size); |
| 304 | /** |
| 305 | * @brief Callback function to flush all internal accessing buffers. |
| 306 | * |
| 307 | * @param[in] clientData Pointer to user-defined data. |
| 308 | * |
| 309 | * @return 0 for success, other value for failure. |
| 310 | */ |
| 311 | FPDF_RESULT (*Flush)(FPDF_LPVOID clientData); |
| 312 | /** |
| 313 | * @brief Callback function to change file size. |
| 314 | * |
| 315 | * @details This function is called under writing mode usually. Implementer |
| 316 | * can determine whether to realize it based on application requests. |
| 317 | * |
| 318 | * @param[in] clientData Pointer to user-defined data. |
| 319 | * @param[in] size New size of file stream, in bytes. |
| 320 | * |
| 321 | * @return 0 for success, other value for failure. |
| 322 | */ |
| 323 | FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size); |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 324 | |
| 325 | } FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER; |
| 326 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 327 | // Function: FPDF_LoadCustomDocument |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 328 | // Load PDF document from a custom access descriptor. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 329 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 330 | // pFileAccess - A structure for access the file. |
| 331 | // password - Optional password for decrypting the PDF file. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 332 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 333 | // A handle to the loaded document. If failed, NULL is returned. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 334 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 335 | // The application should maintain the file resources being valid until |
| 336 | // the PDF document close. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 337 | // Loaded document can be closed by FPDF_CloseDocument. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 338 | // Notes: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 339 | // The application should call ::FPDF_LoadXFA function after PDF |
| 340 | // document loaded |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 341 | // to support XFA fields in fpdfformfill.h file. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 342 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 343 | DLLEXPORT FPDF_DOCUMENT STDCALL |
| 344 | FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 345 | |
| 346 | // Function: FPDF_GetFileVersion |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 347 | // Get the file version of the specific PDF document. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 348 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 349 | // doc - Handle to document. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 350 | // fileVersion - The PDF file version. File version: 14 for 1.4, 15 |
| 351 | // for 1.5, ... |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 352 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 353 | // TRUE if this call succeed, If failed, FALSE is returned. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 354 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 355 | // If the document is created by function ::FPDF_CreateNewDocument, |
| 356 | // then this function would always fail. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 357 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 358 | DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, |
| 359 | int* fileVersion); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 360 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 361 | #define FPDF_ERR_SUCCESS 0 // No error. |
| 362 | #define FPDF_ERR_UNKNOWN 1 // Unknown error. |
| 363 | #define FPDF_ERR_FILE 2 // File not found or could not be opened. |
| 364 | #define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted. |
| 365 | #define FPDF_ERR_PASSWORD 4 // Password required or incorrect password. |
| 366 | #define FPDF_ERR_SECURITY 5 // Unsupported security scheme. |
| 367 | #define FPDF_ERR_PAGE 6 // Page not found or content error. |
| 368 | #define FPDF_ERR_XFALOAD 7 // Load XFA error. |
| 369 | #define FPDF_ERR_XFALAYOUT 8 // Layout XFA error. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 370 | |
| 371 | // Function: FPDF_GetLastError |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 372 | // Get last error code when an SDK function failed. |
| 373 | // Parameters: |
| 374 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 375 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 376 | // A 32-bit integer indicating error codes (defined above). |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 377 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 378 | // If the previous SDK call succeeded, the return value of this |
| 379 | // function |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 380 | // is not defined. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 381 | // |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 382 | DLLEXPORT unsigned long STDCALL FPDF_GetLastError(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 383 | |
| 384 | // Function: FPDF_GetDocPermission |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 385 | // Get file permission flags of the document. |
| 386 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 387 | // document - Handle to document. Returned by FPDF_LoadDocument |
| 388 | // function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 389 | // Return value: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 390 | // A 32-bit integer indicating permission flags. Please refer to PDF |
| 391 | // Reference for |
| 392 | // detailed description. If the document is not protected, 0xffffffff |
| 393 | // will be returned. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 394 | // |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 395 | DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 396 | |
Bo Xu | c5cab02 | 2014-09-19 19:16:31 -0700 | [diff] [blame] | 397 | // Function: FPDF_GetSecurityHandlerRevision |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 398 | // Get the revision for security handler. |
Bo Xu | c5cab02 | 2014-09-19 19:16:31 -0700 | [diff] [blame] | 399 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 400 | // document - Handle to document. Returned by FPDF_LoadDocument |
| 401 | // function. |
Bo Xu | c5cab02 | 2014-09-19 19:16:31 -0700 | [diff] [blame] | 402 | // Return value: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 403 | // The security handler revision number. Please refer to PDF Reference |
| 404 | // for |
| 405 | // detailed description. If the document is not protected, -1 will be |
| 406 | // returned. |
Bo Xu | c5cab02 | 2014-09-19 19:16:31 -0700 | [diff] [blame] | 407 | // |
| 408 | DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document); |
| 409 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 410 | // Function: FPDF_GetPageCount |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 411 | // Get total number of pages in a document. |
| 412 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 413 | // document - Handle to document. Returned by FPDF_LoadDocument |
| 414 | // function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 415 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 416 | // Total number of pages in the document. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 417 | // |
| 418 | DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); |
| 419 | |
| 420 | // Function: FPDF_LoadPage |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 421 | // Load a page inside a document. |
| 422 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 423 | // document - Handle to document. Returned by FPDF_LoadDocument |
| 424 | // function. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 425 | // page_index - Index number of the page. 0 for the first page. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 426 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 427 | // A handle to the loaded page. If failed, NULL is returned. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 428 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 429 | // Loaded page can be rendered to devices using FPDF_RenderPage |
| 430 | // function. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 431 | // Loaded page can be closed by FPDF_ClosePage. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 432 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 433 | DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, |
| 434 | int page_index); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 435 | |
| 436 | // Function: FPDF_GetPageWidth |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 437 | // Get page width. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 438 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 439 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 440 | // function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 441 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 442 | // Page width (excluding non-displayable area) measured in points. |
| 443 | // One point is 1/72 inch (around 0.3528 mm). |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 444 | // |
| 445 | DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); |
| 446 | |
| 447 | // Function: FPDF_GetPageHeight |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 448 | // Get page height. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 449 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 450 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 451 | // function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 452 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 453 | // Page height (excluding non-displayable area) measured in points. |
| 454 | // One point is 1/72 inch (around 0.3528 mm) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 455 | // |
| 456 | DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); |
| 457 | |
| 458 | // Function: FPDF_GetPageSizeByIndex |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 459 | // Get the size of a page by index. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 460 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 461 | // document - Handle to document. Returned by FPDF_LoadDocument |
| 462 | // function. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 463 | // page_index - Page index, zero for the first page. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 464 | // width - Pointer to a double value receiving the page width |
| 465 | // (in points). |
| 466 | // height - Pointer to a double value receiving the page height |
| 467 | // (in points). |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 468 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 469 | // Non-zero for success. 0 for error (document or page not found). |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 470 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 471 | DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, |
| 472 | int page_index, |
| 473 | double* width, |
| 474 | double* height); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 475 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 476 | // Page rendering flags. They can be combined with bit OR. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 477 | #define FPDF_ANNOT 0x01 // Set if annotations are to be rendered. |
| 478 | #define FPDF_LCD_TEXT \ |
| 479 | 0x02 // Set if using text rendering optimized for LCD display. |
| 480 | #define FPDF_NO_NATIVETEXT \ |
| 481 | 0x04 // Don't use the native text output available on some platforms |
| 482 | #define FPDF_GRAYSCALE 0x08 // Grayscale output. |
| 483 | #define FPDF_DEBUG_INFO 0x80 // Set if you want to get some debug info. |
| 484 | // Please discuss with Foxit first if you need to collect debug info. |
| 485 | #define FPDF_NO_CATCH 0x100 // Set if you don't want to catch exception. |
| 486 | #define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 // Limit image cache size. |
| 487 | #define FPDF_RENDER_FORCEHALFTONE \ |
| 488 | 0x400 // Always use halftone for image stretching. |
| 489 | #define FPDF_PRINTING 0x800 // Render for printing. |
| 490 | #define FPDF_REVERSE_BYTE_ORDER \ |
| 491 | 0x10 // set whether render in a reverse Byte order, this flag only |
| 492 | // enable when render to a bitmap. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 493 | #ifdef _WIN32 |
| 494 | // Function: FPDF_RenderPage |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 495 | // Render contents in a page to a device (screen, bitmap, or printer). |
| 496 | // This function is only supported on Windows system. |
| 497 | // Parameters: |
| 498 | // dc - Handle to device context. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 499 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 500 | // function. |
| 501 | // start_x - Left pixel position of the display area in the |
| 502 | // device coordinate. |
| 503 | // start_y - Top pixel position of the display area in the device |
| 504 | // coordinate. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 505 | // size_x - Horizontal size (in pixels) for displaying the page. |
| 506 | // size_y - Vertical size (in pixels) for displaying the page. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 507 | // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees |
| 508 | // clockwise), |
| 509 | // 2 (rotated 180 degrees), 3 (rotated 90 degrees |
| 510 | // counter-clockwise). |
| 511 | // flags - 0 for normal display, or combination of flags |
| 512 | // defined above. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 513 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 514 | // None. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 515 | // Notes: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 516 | // The method can not support to render the page for the document |
| 517 | // consists of dynamic XFA fields. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 518 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 519 | DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, |
| 520 | FPDF_PAGE page, |
| 521 | int start_x, |
| 522 | int start_y, |
| 523 | int size_x, |
| 524 | int size_y, |
| 525 | int rotate, |
| 526 | int flags); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 527 | #endif |
| 528 | |
| 529 | // Function: FPDF_RenderPageBitmap |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 530 | // Render contents in a page to a device independent bitmap |
| 531 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 532 | // bitmap - Handle to the device independent bitmap (as the |
| 533 | // output buffer). |
| 534 | // Bitmap handle can be created by FPDFBitmap_Create |
| 535 | // function. |
| 536 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 537 | // function. |
| 538 | // start_x - Left pixel position of the display area in the |
| 539 | // bitmap coordinate. |
| 540 | // start_y - Top pixel position of the display area in the bitmap |
| 541 | // coordinate. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 542 | // size_x - Horizontal size (in pixels) for displaying the page. |
| 543 | // size_y - Vertical size (in pixels) for displaying the page. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 544 | // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees |
| 545 | // clockwise), |
| 546 | // 2 (rotated 180 degrees), 3 (rotated 90 degrees |
| 547 | // counter-clockwise). |
| 548 | // flags - 0 for normal display, or combination of flags |
| 549 | // defined above. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 550 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 551 | // None. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 552 | // Notes: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 553 | // The method can not support to render the page for the document |
| 554 | // consists of dynamic XFA fields. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 555 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 556 | DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, |
| 557 | FPDF_PAGE page, |
| 558 | int start_x, |
| 559 | int start_y, |
| 560 | int size_x, |
| 561 | int size_y, |
| 562 | int rotate, |
| 563 | int flags); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 564 | |
| 565 | // Function: FPDF_ClosePage |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 566 | // Close a loaded PDF page. |
| 567 | // Parameters: |
| 568 | // page - Handle to the loaded page. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 569 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 570 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 571 | // |
| 572 | DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); |
| 573 | |
| 574 | // Function: FPDF_CloseDocument |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 575 | // Close a loaded PDF document. |
| 576 | // Parameters: |
| 577 | // document - Handle to the loaded document. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 578 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 579 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 580 | // |
| 581 | DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); |
| 582 | |
| 583 | // Function: FPDF_DeviceToPage |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 584 | // Convert the screen coordinate of a point to page coordinate. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 585 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 586 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 587 | // function. |
| 588 | // start_x - Left pixel position of the display area in the |
| 589 | // device coordinate. |
| 590 | // start_y - Top pixel position of the display area in the device |
| 591 | // coordinate. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 592 | // size_x - Horizontal size (in pixels) for displaying the page. |
| 593 | // size_y - Vertical size (in pixels) for displaying the page. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 594 | // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees |
| 595 | // clockwise), |
| 596 | // 2 (rotated 180 degrees), 3 (rotated 90 degrees |
| 597 | // counter-clockwise). |
| 598 | // device_x - X value in device coordinate, for the point to be |
| 599 | // converted. |
| 600 | // device_y - Y value in device coordinate, for the point to be |
| 601 | // converted. |
| 602 | // page_x - A Pointer to a double receiving the converted X |
| 603 | // value in page coordinate. |
| 604 | // page_y - A Pointer to a double receiving the converted Y |
| 605 | // value in page coordinate. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 606 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 607 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 608 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 609 | // The page coordinate system has its origin at left-bottom corner of |
| 610 | // the page, with X axis goes along |
| 611 | // the bottom side to the right, and Y axis goes along the left side |
| 612 | // upward. NOTE: this coordinate system |
| 613 | // can be altered when you zoom, scroll, or rotate a page, however, a |
| 614 | // point on the page should always have |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 615 | // the same coordinate values in the page coordinate system. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 616 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 617 | // The device coordinate system is device dependent. For screen device, |
| 618 | // its origin is at left-top |
| 619 | // corner of the window. However this origin can be altered by Windows |
| 620 | // coordinate transformation |
| 621 | // utilities. You must make sure the start_x, start_y, size_x, size_y |
| 622 | // and rotate parameters have exactly |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 623 | // same values as you used in FPDF_RenderPage() function call. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 624 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 625 | DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, |
| 626 | int start_x, |
| 627 | int start_y, |
| 628 | int size_x, |
| 629 | int size_y, |
| 630 | int rotate, |
| 631 | int device_x, |
| 632 | int device_y, |
| 633 | double* page_x, |
| 634 | double* page_y); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 635 | |
| 636 | // Function: FPDF_PageToDevice |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 637 | // Convert the page coordinate of a point to screen coordinate. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 638 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 639 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 640 | // function. |
| 641 | // start_x - Left pixel position of the display area in the |
| 642 | // device coordinate. |
| 643 | // start_y - Top pixel position of the display area in the device |
| 644 | // coordinate. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 645 | // size_x - Horizontal size (in pixels) for displaying the page. |
| 646 | // size_y - Vertical size (in pixels) for displaying the page. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 647 | // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees |
| 648 | // clockwise), |
| 649 | // 2 (rotated 180 degrees), 3 (rotated 90 degrees |
| 650 | // counter-clockwise). |
| 651 | // page_x - X value in page coordinate, for the point to be |
| 652 | // converted. |
| 653 | // page_y - Y value in page coordinate, for the point to be |
| 654 | // converted. |
| 655 | // device_x - A pointer to an integer receiving the result X value |
| 656 | // in device coordinate. |
| 657 | // device_y - A pointer to an integer receiving the result Y value |
| 658 | // in device coordinate. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 659 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 660 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 661 | // Comments: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 662 | // See comments of FPDF_DeviceToPage() function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 663 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 664 | DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, |
| 665 | int start_x, |
| 666 | int start_y, |
| 667 | int size_x, |
| 668 | int size_y, |
| 669 | int rotate, |
| 670 | double page_x, |
| 671 | double page_y, |
| 672 | int* device_x, |
| 673 | int* device_y); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 674 | |
| 675 | // Function: FPDFBitmap_Create |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 676 | // Create a Foxit Device Independent Bitmap (FXDIB). |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 677 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 678 | // width - Number of pixels in a horizontal line of the bitmap. |
| 679 | // Must be greater than 0. |
| 680 | // height - Number of pixels in a vertical line of the bitmap. |
| 681 | // Must be greater than 0. |
| 682 | // alpha - A flag indicating whether alpha channel is used. |
| 683 | // Non-zero for using alpha, zero for not using. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 684 | // Return value: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 685 | // The created bitmap handle, or NULL if parameter error or out of |
| 686 | // memory. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 687 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 688 | // An FXDIB always use 4 byte per pixel. The first byte of a pixel is |
| 689 | // always double word aligned. |
| 690 | // Each pixel contains red (R), green (G), blue (B) and optionally |
| 691 | // alpha (A) values. |
| 692 | // The byte order is BGRx (the last byte unused if no alpha channel) or |
| 693 | // BGRA. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 694 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 695 | // The pixels in a horizontal line (also called scan line) are stored |
| 696 | // side by side, with left most |
| 697 | // pixel stored first (with lower memory address). Each scan line uses |
| 698 | // width*4 bytes. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 699 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 700 | // Scan lines are stored one after another, with top most scan line |
| 701 | // stored first. There is no gap |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 702 | // between adjacent scan lines. |
| 703 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 704 | // This function allocates enough memory for holding all pixels in the |
| 705 | // bitmap, but it doesn't |
| 706 | // initialize the buffer. Applications can use FPDFBitmap_FillRect to |
| 707 | // fill the bitmap using any color. |
| 708 | DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, |
| 709 | int height, |
| 710 | int alpha); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 711 | |
| 712 | // More DIB formats |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 713 | #define FPDFBitmap_Gray 1 // Gray scale bitmap, one byte per pixel. |
| 714 | #define FPDFBitmap_BGR 2 // 3 bytes per pixel, byte order: blue, green, red. |
| 715 | #define FPDFBitmap_BGRx \ |
| 716 | 3 // 4 bytes per pixel, byte order: blue, green, red, unused. |
| 717 | #define FPDFBitmap_BGRA \ |
| 718 | 4 // 4 bytes per pixel, byte order: blue, green, red, alpha. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 719 | |
| 720 | // Function: FPDFBitmap_CreateEx |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 721 | // Create a Foxit Device Independent Bitmap (FXDIB) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 722 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 723 | // width - Number of pixels in a horizontal line of the bitmap. |
| 724 | // Must be greater than 0. |
| 725 | // height - Number of pixels in a vertical line of the bitmap. |
| 726 | // Must be greater than 0. |
| 727 | // format - A number indicating for bitmap format, as defined |
| 728 | // above. |
| 729 | // first_scan - A pointer to the first byte of first scan line, for |
| 730 | // external buffer |
| 731 | // only. If this parameter is NULL, then the SDK will |
| 732 | // create its own buffer. |
| 733 | // stride - Number of bytes for each scan line, for external |
| 734 | // buffer only.. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 735 | // Return value: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 736 | // The created bitmap handle, or NULL if parameter error or out of |
| 737 | // memory. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 738 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 739 | // Similar to FPDFBitmap_Create function, with more formats and |
| 740 | // external buffer supported. |
| 741 | // Bitmap created by this function can be used in any place that a |
| 742 | // FPDF_BITMAP handle is |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 743 | // required. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 744 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 745 | // If external scanline buffer is used, then the application should |
| 746 | // destroy the buffer |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 747 | // by itself. FPDFBitmap_Destroy function will not destroy the buffer. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 748 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 749 | DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, |
| 750 | int height, |
| 751 | int format, |
| 752 | void* first_scan, |
| 753 | int stride); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 754 | |
| 755 | // Function: FPDFBitmap_FillRect |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 756 | // Fill a rectangle area in an FXDIB. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 757 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 758 | // bitmap - The handle to the bitmap. Returned by |
| 759 | // FPDFBitmap_Create function. |
| 760 | // left - The left side position. Starting from 0 at the |
| 761 | // left-most pixel. |
| 762 | // top - The top side position. Starting from 0 at the |
| 763 | // top-most scan line. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 764 | // width - Number of pixels to be filled in each scan line. |
| 765 | // height - Number of scan lines to be filled. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 766 | // color - A 32-bit value specifing the color, in 8888 ARGB |
| 767 | // format. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 768 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 769 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 770 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 771 | // This function set the color and (optionally) alpha value in |
| 772 | // specified region of the bitmap. |
| 773 | // NOTE: If alpha channel is used, this function does NOT composite the |
| 774 | // background with the source color, |
| 775 | // instead the background will be replaced by the source color and |
| 776 | // alpha. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 777 | // If alpha channel is not used, the "alpha" parameter is ignored. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 778 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 779 | DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, |
| 780 | int left, |
| 781 | int top, |
| 782 | int width, |
| 783 | int height, |
| 784 | FPDF_DWORD color); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 785 | |
| 786 | // Function: FPDFBitmap_GetBuffer |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 787 | // Get data buffer of an FXDIB |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 788 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 789 | // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create |
| 790 | // function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 791 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 792 | // The pointer to the first byte of the bitmap buffer. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 793 | // Comments: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 794 | // The stride may be more than width * number of bytes per pixel |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 795 | // Applications can use this function to get the bitmap buffer pointer, |
| 796 | // then manipulate any color |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 797 | // and/or alpha values for any pixels in the bitmap. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 798 | DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); |
| 799 | |
| 800 | // Function: FPDFBitmap_GetWidth |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 801 | // Get width of an FXDIB. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 802 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 803 | // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create |
| 804 | // function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 805 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 806 | // The number of pixels in a horizontal line of the bitmap. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 807 | DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); |
| 808 | |
| 809 | // Function: FPDFBitmap_GetHeight |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 810 | // Get height of an FXDIB. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 811 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 812 | // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create |
| 813 | // function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 814 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 815 | // The number of pixels in a vertical line of the bitmap. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 816 | DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); |
| 817 | |
| 818 | // Function: FPDFBitmap_GetStride |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 819 | // Get number of bytes for each scan line in the bitmap buffer. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 820 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 821 | // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create |
| 822 | // function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 823 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 824 | // The number of bytes for each scan line in the bitmap buffer. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 825 | // Comments: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 826 | // The stride may be more than width * number of bytes per pixel |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 827 | DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); |
| 828 | |
| 829 | // Function: FPDFBitmap_Destroy |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 830 | // Destroy an FXDIB and release all related buffers. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 831 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 832 | // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create |
| 833 | // function. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 834 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 835 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 836 | // Comments: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 837 | // This function will not destroy any external buffer. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 838 | // |
| 839 | DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); |
| 840 | |
| 841 | // Function: FPDF_VIEWERREF_GetPrintScaling |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 842 | // Whether the PDF document prefers to be scaled or not. |
| 843 | // Parameters: |
| 844 | // document - Handle to the loaded document. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 845 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 846 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 847 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 848 | DLLEXPORT FPDF_BOOL STDCALL |
| 849 | FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 850 | |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 851 | // Function: FPDF_VIEWERREF_GetNumCopies |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 852 | // Returns the number of copies to be printed. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 853 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 854 | // document - Handle to the loaded document. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 855 | // Return value: |
| 856 | // The number of copies to be printed. |
| 857 | // |
| 858 | DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); |
| 859 | |
| 860 | // Function: FPDF_VIEWERREF_GetPrintPageRange |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 861 | // Page numbers to initialize print dialog box when file is printed. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 862 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 863 | // document - Handle to the loaded document. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 864 | // Return value: |
| 865 | // The print page range to be used for printing. |
| 866 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 867 | DLLEXPORT FPDF_PAGERANGE STDCALL |
| 868 | FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 869 | |
| 870 | // Function: FPDF_VIEWERREF_GetDuplex |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 871 | // Returns the paper handling option to be used when printing from |
| 872 | // print dialog. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 873 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 874 | // document - Handle to the loaded document. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 875 | // Return value: |
| 876 | // The paper handling option to be used when printing. |
| 877 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 878 | DLLEXPORT FPDF_DUPLEXTYPE STDCALL |
| 879 | FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 880 | |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 881 | // Function: FPDF_CountNamedDests |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 882 | // Get the count of named destinations in the PDF document. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 883 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 884 | // document - Handle to a document |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 885 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 886 | // The count of named destinations. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 887 | DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document); |
| 888 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 889 | // Function: FPDF_GetNamedDestByName |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 890 | // get a special dest handle by the index. |
| 891 | // Parameters: |
| 892 | // document - Handle to the loaded document. |
| 893 | // name - The name of a special named dest. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 894 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 895 | // The handle of the dest. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 896 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 897 | DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, |
| 898 | FPDF_BYTESTRING name); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 899 | |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 900 | // Function: FPDF_GetNamedDest |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 901 | // Get the specified named destinations of the PDF document by index. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 902 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 903 | // document - Handle to a document |
| 904 | // index - The index of named destination. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 905 | // buffer - The buffer to obtain destination name, used as |
| 906 | // wchar_t*. |
| 907 | // buflen [in/out] - Size of the buffer in bytes on input, length of |
| 908 | // the result in bytes on output or -1 if the buffer is too small. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 909 | // Return value: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 910 | // The destination handle of a named destination, or NULL if no named |
| 911 | // destination corresponding to |index|. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 912 | // Comments: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 913 | // Call this function twice to get the name of the named destination: |
| 914 | // 1) First time pass in |buffer| as NULL and get buflen. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 915 | // 2) Second time pass in allocated |buffer| and buflen to retrieve |
| 916 | // |buffer|, which should be used as wchar_t*. |
| 917 | // If buflen is not sufficiently large, it will be set to -1 upon |
| 918 | // return. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 919 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 920 | DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, |
| 921 | int index, |
| 922 | void* buffer, |
| 923 | long* buflen); |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 924 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 925 | // Function: FPDF_BStr_Init |
| 926 | // Helper function to initialize a byte string. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 927 | DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str); |
| 928 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 929 | // Function: FPDF_BStr_Set |
| 930 | // Helper function to set string data. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame^] | 931 | DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, |
| 932 | FPDF_LPCSTR bstr, |
| 933 | int length); |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 934 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 935 | // Function: FPDF_BStr_Clear |
| 936 | // Helper function to clear a byte string. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 937 | DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str); |
| 938 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 939 | #ifdef __cplusplus |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 940 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 941 | #endif |
| 942 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 943 | #endif // PUBLIC_FPDFVIEW_H_ |