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