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