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