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