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 | |
rbpotter | 38a01b9 | 2017-07-13 11:58:01 -0700 | [diff] [blame^] | 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 unsuccessful (typically invalid input). |
| 258 | DLLEXPORT FPDF_BOOL STDCALL FPDF_SetPrintPostscriptLevel(int postscript_level); |
| 259 | |
rbpotter | e8468c4 | 2017-07-11 10:04:29 -0700 | [diff] [blame] | 260 | // Function: FPDF_SetPrintMode |
| 261 | // Set printing mode when printing on Windows. |
rbpotter | db76470 | 2017-01-12 10:31:43 -0800 | [diff] [blame] | 262 | // Experimental API. |
| 263 | // Parameters: |
rbpotter | e8468c4 | 2017-07-11 10:04:29 -0700 | [diff] [blame] | 264 | // mode - FPDF_PRINTMODE_EMF to output EMF (default) |
| 265 | // FPDF_PRINTMODE_TEXTONLY to output text only (for charstream |
| 266 | // devices) |
| 267 | // FPDF_PRINTMODE_POSTSCRIPT2 to output level 2 postscript |
| 268 | // FPDF_PRINTMODE_POSTSCRIPT3 to output level 3 postscript |
rbpotter | db76470 | 2017-01-12 10:31:43 -0800 | [diff] [blame] | 269 | // Return value: |
rbpotter | e8468c4 | 2017-07-11 10:04:29 -0700 | [diff] [blame] | 270 | // True if successful, false if unsuccessful (typically invalid input). |
| 271 | DLLEXPORT FPDF_BOOL STDCALL FPDF_SetPrintMode(int mode); |
rbpotter | db76470 | 2017-01-12 10:31:43 -0800 | [diff] [blame] | 272 | #endif // defined(_WIN32) |
thestig | fdb35ff | 2016-07-18 13:45:44 -0700 | [diff] [blame] | 273 | |
Tom Sepez | 3c3201f | 2015-05-20 10:20:35 -0700 | [diff] [blame] | 274 | // Function: FPDF_LoadDocument |
| 275 | // Open and load a PDF document. |
| 276 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 277 | // file_path - Path to the PDF file (including extension). |
| 278 | // password - A string used as the password for the PDF file. |
| 279 | // If no password is needed, empty or NULL can be used. |
Tom Sepez | 3c3201f | 2015-05-20 10:20:35 -0700 | [diff] [blame] | 280 | // Return value: |
| 281 | // A handle to the loaded document, or NULL on failure. |
| 282 | // Comments: |
| 283 | // Loaded document can be closed by FPDF_CloseDocument(). |
| 284 | // If this function fails, you can use FPDF_GetLastError() to retrieve |
| 285 | // the reason why it failed. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 286 | DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 287 | FPDF_BYTESTRING password); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 288 | |
| 289 | // Function: FPDF_LoadMemDocument |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 290 | // Open and load a PDF document from memory. |
| 291 | // Parameters: |
| 292 | // data_buf - Pointer to a buffer containing the PDF document. |
| 293 | // size - Number of bytes in the PDF document. |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 294 | // password - A string used as the password for the PDF file. |
| 295 | // 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] | 296 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 297 | // A handle to the loaded document, or NULL on failure. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 298 | // Comments: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 299 | // The memory buffer must remain valid when the document is open. |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 300 | // The loaded document can be closed by FPDF_CloseDocument. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 301 | // If this function fails, you can use FPDF_GetLastError() to retrieve |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 302 | // the reason why it failed. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 303 | // Notes: |
Tom Sepez | c46d000 | 2015-11-30 15:46:36 -0800 | [diff] [blame] | 304 | // If PDFium is built with the XFA module, the application should call |
| 305 | // FPDF_LoadXFA() function after the PDF document loaded to support XFA |
| 306 | // fields defined in the fpdfformfill.h file. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 307 | DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 308 | int size, |
| 309 | FPDF_BYTESTRING password); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 310 | |
| 311 | // Structure for custom file access. |
| 312 | typedef struct { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 313 | // File length, in bytes. |
| 314 | unsigned long m_FileLen; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 315 | |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 316 | // A function pointer for getting a block of data from a specific position. |
| 317 | // Position is specified by byte offset from the beginning of the file. |
| 318 | // 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] | 319 | // 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] | 320 | // the same position. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 321 | // Return value: should be non-zero if successful, zero for error. |
| 322 | int (*m_GetBlock)(void* param, |
| 323 | unsigned long position, |
| 324 | unsigned char* pBuf, |
| 325 | unsigned long size); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 326 | |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 327 | // A custom pointer for all implementation specific data. This pointer will |
| 328 | // be used as the first parameter to the m_GetBlock callback. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 329 | void* m_Param; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 330 | } FPDF_FILEACCESS; |
| 331 | |
Tom Sepez | c46d000 | 2015-11-30 15:46:36 -0800 | [diff] [blame] | 332 | #ifdef PDF_ENABLE_XFA |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 333 | /** |
| 334 | * @brief Structure for file reading or writing (I/O). |
| 335 | * |
| 336 | * @note This is a handler and should be implemented by callers. |
| 337 | */ |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 338 | typedef struct _FPDF_FILEHANDLER { |
| 339 | /** |
| 340 | * @brief User-defined data. |
| 341 | * @note Callers can use this field to track controls. |
| 342 | */ |
| 343 | FPDF_LPVOID clientData; |
| 344 | /** |
| 345 | * @brief Callback function to release the current file stream object. |
| 346 | * |
| 347 | * @param[in] clientData Pointer to user-defined data. |
| 348 | * |
| 349 | * @return None. |
| 350 | */ |
| 351 | void (*Release)(FPDF_LPVOID clientData); |
| 352 | /** |
| 353 | * @brief Callback function to retrieve the current file stream size. |
| 354 | * |
| 355 | * @param[in] clientData Pointer to user-defined data. |
| 356 | * |
| 357 | * @return Size of file stream. |
| 358 | */ |
| 359 | FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData); |
| 360 | /** |
| 361 | * @brief Callback function to read data from the current file stream. |
| 362 | * |
| 363 | * @param[in] clientData Pointer to user-defined data. |
| 364 | * @param[in] offset Offset position starts from the beginning of file |
| 365 | * stream. This parameter indicates reading position. |
| 366 | * @param[in] buffer Memory buffer to store data which are read from |
| 367 | * file stream. This parameter should not be <b>NULL</b>. |
| 368 | * @param[in] size Size of data which should be read from file |
| 369 | * stream, in bytes. The buffer indicated by the parameter <i>buffer</i> |
| 370 | * should be enough to store specified data. |
| 371 | * |
| 372 | * @return 0 for success, other value for failure. |
| 373 | */ |
Dan Sinclair | 3ebd121 | 2016-03-09 09:59:23 -0500 | [diff] [blame] | 374 | FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData, |
| 375 | FPDF_DWORD offset, |
| 376 | FPDF_LPVOID buffer, |
| 377 | FPDF_DWORD size); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 378 | /** |
| 379 | * @brief Callback function to write data into the current file stream. |
| 380 | * |
| 381 | * @param[in] clientData Pointer to user-defined data. |
| 382 | * @param[in] offset Offset position starts from the beginning of file |
| 383 | * stream. This parameter indicates writing position. |
| 384 | * @param[in] buffer Memory buffer contains data which is written into |
| 385 | * file stream. This parameter should not be <b>NULL</b>. |
| 386 | * @param[in] size Size of data which should be written into file |
| 387 | * stream, in bytes. |
| 388 | * |
| 389 | * @return 0 for success, other value for failure. |
| 390 | */ |
Dan Sinclair | 3ebd121 | 2016-03-09 09:59:23 -0500 | [diff] [blame] | 391 | FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData, |
| 392 | FPDF_DWORD offset, |
| 393 | FPDF_LPCVOID buffer, |
| 394 | FPDF_DWORD size); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 395 | /** |
| 396 | * @brief Callback function to flush all internal accessing buffers. |
| 397 | * |
| 398 | * @param[in] clientData Pointer to user-defined data. |
| 399 | * |
| 400 | * @return 0 for success, other value for failure. |
| 401 | */ |
| 402 | FPDF_RESULT (*Flush)(FPDF_LPVOID clientData); |
| 403 | /** |
| 404 | * @brief Callback function to change file size. |
| 405 | * |
| 406 | * @details This function is called under writing mode usually. Implementer |
| 407 | * can determine whether to realize it based on application requests. |
| 408 | * |
| 409 | * @param[in] clientData Pointer to user-defined data. |
| 410 | * @param[in] size New size of file stream, in bytes. |
| 411 | * |
| 412 | * @return 0 for success, other value for failure. |
| 413 | */ |
| 414 | FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size); |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 415 | } FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER; |
| 416 | |
Tom Sepez | c46d000 | 2015-11-30 15:46:36 -0800 | [diff] [blame] | 417 | #endif |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 418 | // Function: FPDF_LoadCustomDocument |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 419 | // Load PDF document from a custom access descriptor. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 420 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 421 | // pFileAccess - A structure for accessing the file. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 422 | // password - Optional password for decrypting the PDF file. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 423 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 424 | // A handle to the loaded document, or NULL on failure. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 425 | // Comments: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 426 | // The application must keep the file resources valid until the PDF |
| 427 | // document is closed. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 428 | // |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 429 | // The loaded document can be closed with FPDF_CloseDocument. |
| 430 | // Notes: |
Tom Sepez | c46d000 | 2015-11-30 15:46:36 -0800 | [diff] [blame] | 431 | // If PDFium is built with the XFA module, the application should call |
| 432 | // FPDF_LoadXFA() function after the PDF document loaded to support XFA |
| 433 | // fields defined in the fpdfformfill.h file. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 434 | DLLEXPORT FPDF_DOCUMENT STDCALL |
| 435 | FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 436 | |
| 437 | // Function: FPDF_GetFileVersion |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 438 | // Get the file version of the given PDF document. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 439 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 440 | // doc - Handle to a document. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 441 | // fileVersion - The PDF file version. File version: 14 for 1.4, 15 |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 442 | // for 1.5, ... |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 443 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 444 | // True if succeeds, false otherwise. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 445 | // Comments: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 446 | // If the document was created by FPDF_CreateNewDocument, |
| 447 | // then this function will always fail. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 448 | DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, |
| 449 | int* fileVersion); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 450 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 451 | #define FPDF_ERR_SUCCESS 0 // No error. |
| 452 | #define FPDF_ERR_UNKNOWN 1 // Unknown error. |
| 453 | #define FPDF_ERR_FILE 2 // File not found or could not be opened. |
| 454 | #define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted. |
| 455 | #define FPDF_ERR_PASSWORD 4 // Password required or incorrect password. |
| 456 | #define FPDF_ERR_SECURITY 5 // Unsupported security scheme. |
| 457 | #define FPDF_ERR_PAGE 6 // Page not found or content error. |
Tom Sepez | c46d000 | 2015-11-30 15:46:36 -0800 | [diff] [blame] | 458 | #ifdef PDF_ENABLE_XFA |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 459 | #define FPDF_ERR_XFALOAD 7 // Load XFA error. |
| 460 | #define FPDF_ERR_XFALAYOUT 8 // Layout XFA error. |
Tom Sepez | c46d000 | 2015-11-30 15:46:36 -0800 | [diff] [blame] | 461 | #endif // PDF_ENABLE_XFA |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 462 | |
| 463 | // Function: FPDF_GetLastError |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 464 | // Get last error code when a function fails. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 465 | // Parameters: |
| 466 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 467 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 468 | // A 32-bit integer indicating error code as defined above. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 469 | // Comments: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 470 | // If the previous SDK call succeeded, the return value of this |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 471 | // function is not defined. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 472 | DLLEXPORT unsigned long STDCALL FPDF_GetLastError(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 473 | |
| 474 | // Function: FPDF_GetDocPermission |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 475 | // Get file permission flags of the document. |
| 476 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 477 | // document - Handle to a document. Returned by FPDF_LoadDocument. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 478 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 479 | // A 32-bit integer indicating permission flags. Please refer to the |
| 480 | // PDF Reference for detailed descriptions. If the document is not |
| 481 | // protected, 0xffffffff will be returned. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 482 | DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 483 | |
Bo Xu | c5cab02 | 2014-09-19 19:16:31 -0700 | [diff] [blame] | 484 | // Function: FPDF_GetSecurityHandlerRevision |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 485 | // Get the revision for the security handler. |
Bo Xu | c5cab02 | 2014-09-19 19:16:31 -0700 | [diff] [blame] | 486 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 487 | // document - Handle to a document. Returned by FPDF_LoadDocument. |
Bo Xu | c5cab02 | 2014-09-19 19:16:31 -0700 | [diff] [blame] | 488 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 489 | // The security handler revision number. Please refer to the PDF |
| 490 | // Reference for a detailed description. If the document is not |
| 491 | // protected, -1 will be returned. |
Bo Xu | c5cab02 | 2014-09-19 19:16:31 -0700 | [diff] [blame] | 492 | DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document); |
| 493 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 494 | // Function: FPDF_GetPageCount |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 495 | // Get total number of pages in the document. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 496 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 497 | // document - Handle to document. Returned by FPDF_LoadDocument. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 498 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 499 | // Total number of pages in the document. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 500 | DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); |
| 501 | |
| 502 | // Function: FPDF_LoadPage |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 503 | // Load a page inside the document. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 504 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 505 | // document - Handle to document. Returned by FPDF_LoadDocument |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 506 | // 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] | 507 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 508 | // 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] | 509 | // Comments: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 510 | // The loaded page can be rendered to devices using FPDF_RenderPage. |
| 511 | // The loaded page can be closed using FPDF_ClosePage. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 512 | DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, |
| 513 | int page_index); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 514 | |
| 515 | // Function: FPDF_GetPageWidth |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 516 | // Get page width. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 517 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 518 | // page - Handle to the page. Returned by FPDF_LoadPage. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 519 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 520 | // Page width (excluding non-displayable area) measured in points. |
| 521 | // One point is 1/72 inch (around 0.3528 mm). |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 522 | DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); |
| 523 | |
| 524 | // Function: FPDF_GetPageHeight |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 525 | // Get page height. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 526 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 527 | // page - Handle to the page. Returned by FPDF_LoadPage. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 528 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 529 | // Page height (excluding non-displayable area) measured in points. |
| 530 | // One point is 1/72 inch (around 0.3528 mm) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 531 | DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); |
| 532 | |
| 533 | // Function: FPDF_GetPageSizeByIndex |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 534 | // Get the size of the page at the given index. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 535 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 536 | // document - Handle to document. Returned by FPDF_LoadDocument. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 537 | // page_index - Page index, zero for the first page. |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 538 | // width - Pointer to a double to receive the page width |
| 539 | // (in points). |
| 540 | // height - Pointer to a double to receive the page height |
| 541 | // (in points). |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 542 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 543 | // Non-zero for success. 0 for error (document or page not found). |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 544 | DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, |
| 545 | int page_index, |
| 546 | double* width, |
| 547 | double* height); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 548 | |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 549 | // Page rendering flags. They can be combined with bit-wise OR. |
| 550 | // |
| 551 | // Set if annotations are to be rendered. |
| 552 | #define FPDF_ANNOT 0x01 |
| 553 | // Set if using text rendering optimized for LCD display. |
| 554 | #define FPDF_LCD_TEXT 0x02 |
| 555 | // Don't use the native text output available on some platforms |
| 556 | #define FPDF_NO_NATIVETEXT 0x04 |
| 557 | // Grayscale output. |
| 558 | #define FPDF_GRAYSCALE 0x08 |
| 559 | // Set if you want to get some debug info. |
| 560 | #define FPDF_DEBUG_INFO 0x80 |
| 561 | // Set if you don't want to catch exceptions. |
| 562 | #define FPDF_NO_CATCH 0x100 |
| 563 | // Limit image cache size. |
| 564 | #define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 |
| 565 | // Always use halftone for image stretching. |
| 566 | #define FPDF_RENDER_FORCEHALFTONE 0x400 |
| 567 | // Render for printing. |
| 568 | #define FPDF_PRINTING 0x800 |
| 569 | // Set to disable anti-aliasing on text. |
| 570 | #define FPDF_RENDER_NO_SMOOTHTEXT 0x1000 |
| 571 | // Set to disable anti-aliasing on images. |
| 572 | #define FPDF_RENDER_NO_SMOOTHIMAGE 0x2000 |
| 573 | // Set to disable anti-aliasing on paths. |
| 574 | #define FPDF_RENDER_NO_SMOOTHPATH 0x4000 |
| 575 | // Set whether to render in a reverse Byte order, this flag is only used when |
| 576 | // rendering to a bitmap. |
| 577 | #define FPDF_REVERSE_BYTE_ORDER 0x10 |
| 578 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 579 | #ifdef _WIN32 |
| 580 | // Function: FPDF_RenderPage |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 581 | // Render contents of a page to a device (screen, bitmap, or printer). |
| 582 | // This function is only supported on Windows. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 583 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 584 | // dc - Handle to the device context. |
| 585 | // page - Handle to the page. Returned by FPDF_LoadPage. |
| 586 | // start_x - Left pixel position of the display area in |
| 587 | // device coordinates. |
| 588 | // start_y - Top pixel position of the display area in device |
| 589 | // coordinates. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 590 | // size_x - Horizontal size (in pixels) for displaying the page. |
| 591 | // size_y - Vertical size (in pixels) for displaying the page. |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 592 | // rotate - Page orientation: |
| 593 | // 0 (normal) |
| 594 | // 1 (rotated 90 degrees clockwise) |
| 595 | // 2 (rotated 180 degrees) |
| 596 | // 3 (rotated 90 degrees counter-clockwise) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 597 | // flags - 0 for normal display, or combination of flags |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 598 | // defined above. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 599 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 600 | // None. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 601 | DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, |
| 602 | FPDF_PAGE page, |
| 603 | int start_x, |
| 604 | int start_y, |
| 605 | int size_x, |
| 606 | int size_y, |
| 607 | int rotate, |
| 608 | int flags); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 609 | #endif |
| 610 | |
| 611 | // Function: FPDF_RenderPageBitmap |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 612 | // Render contents of a page to a device independent bitmap. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 613 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 614 | // bitmap - Handle to the device independent bitmap (as the |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 615 | // output buffer). The bitmap handle can be created |
| 616 | // by FPDFBitmap_Create. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 617 | // page - Handle to the page. Returned by FPDF_LoadPage |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 618 | // start_x - Left pixel position of the display area in |
| 619 | // bitmap coordinates. |
| 620 | // start_y - Top pixel position of the display area in bitmap |
| 621 | // coordinates. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 622 | // size_x - Horizontal size (in pixels) for displaying the page. |
| 623 | // size_y - Vertical size (in pixels) for displaying the page. |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 624 | // rotate - Page orientation: |
| 625 | // 0 (normal) |
| 626 | // 1 (rotated 90 degrees clockwise) |
| 627 | // 2 (rotated 180 degrees) |
| 628 | // 3 (rotated 90 degrees counter-clockwise) |
thestig | a78ba60 | 2016-11-23 15:25:48 -0800 | [diff] [blame] | 629 | // flags - 0 for normal display, or combination of the Page |
| 630 | // Rendering flags defined above. With the FPDF_ANNOT |
| 631 | // flag, it renders all annotations that do not require |
| 632 | // user-interaction, which are all annotations except |
| 633 | // widget and popup annotations. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 634 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 635 | // None. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 636 | DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, |
| 637 | FPDF_PAGE page, |
| 638 | int start_x, |
| 639 | int start_y, |
| 640 | int size_x, |
| 641 | int size_y, |
| 642 | int rotate, |
| 643 | int flags); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 644 | |
thestig | a78ba60 | 2016-11-23 15:25:48 -0800 | [diff] [blame] | 645 | // Function: FPDF_RenderPageBitmapWithMatrix |
| 646 | // Render contents of a page to a device independent bitmap. |
| 647 | // Parameters: |
| 648 | // bitmap - Handle to the device independent bitmap (as the |
| 649 | // output buffer). The bitmap handle can be created |
| 650 | // by FPDFBitmap_Create. |
| 651 | // page - Handle to the page. Returned by FPDF_LoadPage |
| 652 | // matrix - The transform matrix. |
| 653 | // clipping - The rect to clip to. |
| 654 | // flags - 0 for normal display, or combination of the Page |
| 655 | // Rendering flags defined above. With the FPDF_ANNOT |
| 656 | // flag, it renders all annotations that do not require |
| 657 | // user-interaction, which are all annotations except |
| 658 | // widget and popup annotations. |
| 659 | // Return value: |
| 660 | // None. |
| 661 | DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, |
| 662 | FPDF_PAGE page, |
| 663 | const FS_MATRIX* matrix, |
| 664 | const FS_RECTF* clipping, |
| 665 | int flags); |
| 666 | |
Cary Clark | 399be5b | 2016-03-14 16:51:29 -0400 | [diff] [blame] | 667 | #ifdef _SKIA_SUPPORT_ |
| 668 | DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page, |
| 669 | int size_x, |
| 670 | int size_y); |
| 671 | #endif |
| 672 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 673 | // Function: FPDF_ClosePage |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 674 | // Close a loaded PDF page. |
| 675 | // Parameters: |
| 676 | // page - Handle to the loaded page. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 677 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 678 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 679 | DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); |
| 680 | |
| 681 | // Function: FPDF_CloseDocument |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 682 | // Close a loaded PDF document. |
| 683 | // Parameters: |
| 684 | // document - Handle to the loaded document. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 685 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 686 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 687 | DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); |
| 688 | |
| 689 | // Function: FPDF_DeviceToPage |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 690 | // Convert the screen coordinates of a point to page coordinates. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 691 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 692 | // page - Handle to the page. Returned by FPDF_LoadPage. |
| 693 | // start_x - Left pixel position of the display area in |
| 694 | // device coordinates. |
| 695 | // start_y - Top pixel position of the display area in device |
| 696 | // coordinates. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 697 | // size_x - Horizontal size (in pixels) for displaying the page. |
| 698 | // size_y - Vertical size (in pixels) for displaying the page. |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 699 | // rotate - Page orientation: |
| 700 | // 0 (normal) |
| 701 | // 1 (rotated 90 degrees clockwise) |
| 702 | // 2 (rotated 180 degrees) |
| 703 | // 3 (rotated 90 degrees counter-clockwise) |
| 704 | // device_x - X value in device coordinates to be converted. |
| 705 | // device_y - Y value in device coordinates to be converted. |
| 706 | // page_x - A pointer to a double receiving the converted X |
| 707 | // value in page coordinates. |
| 708 | // page_y - A pointer to a double receiving the converted Y |
| 709 | // value in page coordinates. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 710 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 711 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 712 | // Comments: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 713 | // The page coordinate system has its origin at the left-bottom corner |
| 714 | // of the page, with the X-axis on the bottom going to the right, and |
| 715 | // the Y-axis on the left side going up. |
| 716 | // |
| 717 | // NOTE: this coordinate system can be altered when you zoom, scroll, |
| 718 | // 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] | 719 | // the same coordinate values in the page coordinate system. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 720 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 721 | // The device coordinate system is device dependent. For screen device, |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 722 | // its origin is at the left-top corner of the window. However this |
| 723 | // origin can be altered by the Windows coordinate transformation |
| 724 | // utilities. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 725 | // |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 726 | // You must make sure the start_x, start_y, size_x, size_y |
| 727 | // and rotate parameters have exactly same values as you used in |
| 728 | // the FPDF_RenderPage() function call. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 729 | DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, |
| 730 | int start_x, |
| 731 | int start_y, |
| 732 | int size_x, |
| 733 | int size_y, |
| 734 | int rotate, |
| 735 | int device_x, |
| 736 | int device_y, |
| 737 | double* page_x, |
| 738 | double* page_y); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 739 | |
| 740 | // Function: FPDF_PageToDevice |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 741 | // Convert the page coordinates of a point to screen coordinates. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 742 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 743 | // page - Handle to the page. Returned by FPDF_LoadPage. |
| 744 | // start_x - Left pixel position of the display area in |
| 745 | // device coordinates. |
| 746 | // start_y - Top pixel position of the display area in device |
| 747 | // coordinates. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 748 | // size_x - Horizontal size (in pixels) for displaying the page. |
| 749 | // size_y - Vertical size (in pixels) for displaying the page. |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 750 | // rotate - Page orientation: |
| 751 | // 0 (normal) |
| 752 | // 1 (rotated 90 degrees clockwise) |
| 753 | // 2 (rotated 180 degrees) |
| 754 | // 3 (rotated 90 degrees counter-clockwise) |
| 755 | // page_x - X value in page coordinates. |
| 756 | // page_y - Y value in page coordinate. |
| 757 | // device_x - A pointer to an integer receiving the result X |
| 758 | // value in device coordinates. |
| 759 | // device_y - A pointer to an integer receiving the result Y |
| 760 | // value in device coordinates. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 761 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 762 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 763 | // Comments: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 764 | // See comments for FPDF_DeviceToPage(). |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 765 | DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, |
| 766 | int start_x, |
| 767 | int start_y, |
| 768 | int size_x, |
| 769 | int size_y, |
| 770 | int rotate, |
| 771 | double page_x, |
| 772 | double page_y, |
| 773 | int* device_x, |
| 774 | int* device_y); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 775 | |
| 776 | // Function: FPDFBitmap_Create |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 777 | // Create a device independent bitmap (FXDIB). |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 778 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 779 | // width - The number of pixels in width for the bitmap. |
| 780 | // Must be greater than 0. |
| 781 | // height - The number of pixels in height for the bitmap. |
| 782 | // Must be greater than 0. |
| 783 | // alpha - A flag indicating whether the alpha channel is used. |
| 784 | // Non-zero for using alpha, zero for not using. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 785 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 786 | // 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] | 787 | // memory. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 788 | // Comments: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 789 | // The bitmap always uses 4 bytes per pixel. The first byte is always |
| 790 | // double word aligned. |
| 791 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 792 | // The byte order is BGRx (the last byte unused if no alpha channel) or |
| 793 | // BGRA. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 794 | // |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 795 | // The pixels in a horizontal line are stored side by side, with the |
| 796 | // left most pixel stored first (with lower memory address). |
| 797 | // Each line uses width * 4 bytes. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 798 | // |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 799 | // Lines are stored one after another, with the top most line stored |
| 800 | // first. There is no gap between adjacent lines. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 801 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 802 | // This function allocates enough memory for holding all pixels in the |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 803 | // bitmap, but it doesn't initialize the buffer. Applications can use |
| 804 | // FPDFBitmap_FillRect to fill the bitmap using any color. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 805 | DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, |
| 806 | int height, |
| 807 | int alpha); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 808 | |
| 809 | // More DIB formats |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 810 | // Gray scale bitmap, one byte per pixel. |
| 811 | #define FPDFBitmap_Gray 1 |
| 812 | // 3 bytes per pixel, byte order: blue, green, red. |
| 813 | #define FPDFBitmap_BGR 2 |
| 814 | // 4 bytes per pixel, byte order: blue, green, red, unused. |
| 815 | #define FPDFBitmap_BGRx 3 |
| 816 | // 4 bytes per pixel, byte order: blue, green, red, alpha. |
| 817 | #define FPDFBitmap_BGRA 4 |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 818 | |
| 819 | // Function: FPDFBitmap_CreateEx |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 820 | // Create a device independent bitmap (FXDIB) |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 821 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 822 | // width - The number of pixels in width for the bitmap. |
| 823 | // Must be greater than 0. |
| 824 | // height - The number of pixels in height for the bitmap. |
| 825 | // Must be greater than 0. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 826 | // format - A number indicating for bitmap format, as defined |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 827 | // above. |
| 828 | // first_scan - A pointer to the first byte of the first line if |
| 829 | // using an external buffer. If this parameter is NULL, |
| 830 | // then the a new buffer will be created. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 831 | // stride - Number of bytes for each scan line, for external |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 832 | // buffer only. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 833 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 834 | // 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] | 835 | // Comments: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 836 | // Similar to FPDFBitmap_Create function, but allows for more formats |
| 837 | // and an external buffer is supported. The bitmap created by this |
| 838 | // 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] | 839 | // required. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 840 | // |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 841 | // If an external buffer is used, then the application should destroy |
| 842 | // the buffer by itself. FPDFBitmap_Destroy function will not destroy |
| 843 | // the buffer. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 844 | DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, |
| 845 | int height, |
| 846 | int format, |
| 847 | void* first_scan, |
| 848 | int stride); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 849 | |
| 850 | // Function: FPDFBitmap_FillRect |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 851 | // Fill a rectangle in a bitmap. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 852 | // Parameters: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 853 | // bitmap - The handle to the bitmap. Returned by |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 854 | // FPDFBitmap_Create. |
| 855 | // left - The left position. Starting from 0 at the |
| 856 | // left-most pixel. |
| 857 | // top - The top position. Starting from 0 at the |
| 858 | // top-most line. |
| 859 | // width - Width in pixels to be filled. |
| 860 | // height - Height in pixels to be filled. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 861 | // color - A 32-bit value specifing the color, in 8888 ARGB |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 862 | // format. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 863 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 864 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 865 | // Comments: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 866 | // This function sets the color and (optionally) alpha value in the |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 867 | // specified region of the bitmap. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 868 | // |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 869 | // NOTE: If the alpha channel is used, this function does NOT |
| 870 | // composite the background with the source color, instead the |
| 871 | // background will be replaced by the source color and the alpha. |
| 872 | // |
| 873 | // If the alpha channel is not used, the alpha parameter is ignored. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 874 | DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, |
| 875 | int left, |
| 876 | int top, |
| 877 | int width, |
| 878 | int height, |
| 879 | FPDF_DWORD color); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 880 | |
| 881 | // Function: FPDFBitmap_GetBuffer |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 882 | // Get data buffer of a bitmap. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 883 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 884 | // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 885 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 886 | // The pointer to the first byte of the bitmap buffer. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 887 | // Comments: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 888 | // The stride may be more than width * number of bytes per pixel |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 889 | // |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 890 | // Applications can use this function to get the bitmap buffer pointer, |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 891 | // then manipulate any color and/or alpha values for any pixels in the |
| 892 | // bitmap. |
| 893 | // |
| 894 | // The data is in BGRA format. Where the A maybe unused if alpha was |
| 895 | // not specified. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 896 | DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); |
| 897 | |
| 898 | // Function: FPDFBitmap_GetWidth |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 899 | // Get width of a bitmap. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 900 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 901 | // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 902 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 903 | // The width of the bitmap in pixels. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 904 | DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); |
| 905 | |
| 906 | // Function: FPDFBitmap_GetHeight |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 907 | // Get height of a bitmap. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 908 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 909 | // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 910 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 911 | // The height of the bitmap in pixels. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 912 | DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); |
| 913 | |
| 914 | // Function: FPDFBitmap_GetStride |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 915 | // 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] | 916 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 917 | // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 918 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 919 | // 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] | 920 | // Comments: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 921 | // 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] | 922 | DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); |
| 923 | |
| 924 | // Function: FPDFBitmap_Destroy |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 925 | // Destroy a bitmap and release all related buffers. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 926 | // Parameters: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 927 | // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 928 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 929 | // None. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 930 | // Comments: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 931 | // This function will not destroy any external buffers provided when |
| 932 | // the bitmap was created. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 933 | DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); |
| 934 | |
| 935 | // Function: FPDF_VIEWERREF_GetPrintScaling |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 936 | // Whether the PDF document prefers to be scaled or not. |
| 937 | // Parameters: |
| 938 | // document - Handle to the loaded document. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 939 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 940 | // None. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 941 | DLLEXPORT FPDF_BOOL STDCALL |
| 942 | FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 943 | |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 944 | // Function: FPDF_VIEWERREF_GetNumCopies |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 945 | // Returns the number of copies to be printed. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 946 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 947 | // document - Handle to the loaded document. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 948 | // Return value: |
| 949 | // The number of copies to be printed. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 950 | DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); |
| 951 | |
| 952 | // Function: FPDF_VIEWERREF_GetPrintPageRange |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 953 | // Page numbers to initialize print dialog box when file is printed. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 954 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 955 | // document - Handle to the loaded document. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 956 | // Return value: |
| 957 | // The print page range to be used for printing. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 958 | DLLEXPORT FPDF_PAGERANGE STDCALL |
| 959 | FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 960 | |
| 961 | // Function: FPDF_VIEWERREF_GetDuplex |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 962 | // Returns the paper handling option to be used when printing from |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 963 | // the print dialog. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 964 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 965 | // document - Handle to the loaded document. |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 966 | // Return value: |
| 967 | // The paper handling option to be used when printing. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 968 | DLLEXPORT FPDF_DUPLEXTYPE STDCALL |
| 969 | FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); |
Bo Xu | 9114e83 | 2014-07-14 13:22:47 -0700 | [diff] [blame] | 970 | |
thestig | 04bebfe | 2016-11-04 16:07:25 -0700 | [diff] [blame] | 971 | // Function: FPDF_VIEWERREF_GetName |
| 972 | // Gets the contents for a viewer ref, with a given key. The value must |
| 973 | // be of type "name". |
| 974 | // Parameters: |
| 975 | // document - Handle to the loaded document. |
| 976 | // key - Name of the key in the viewer pref dictionary. |
| 977 | // buffer - A string to write the contents of the key to. |
| 978 | // length - Length of the buffer. |
| 979 | // Return value: |
| 980 | // The number of bytes in the contents, including the NULL terminator. |
| 981 | // Thus if the return value is 0, then that indicates an error, such |
| 982 | // as when |document| is invalid or |buffer| is NULL. If |length| is |
| 983 | // less than the returned length, or |buffer| is NULL, |buffer| will |
| 984 | // not be modified. |
| 985 | DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document, |
| 986 | FPDF_BYTESTRING key, |
| 987 | char* buffer, |
| 988 | unsigned long length); |
| 989 | |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 990 | // Function: FPDF_CountNamedDests |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 991 | // Get the count of named destinations in the PDF document. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 992 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 993 | // document - Handle to a document |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 994 | // Return value: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 995 | // The count of named destinations. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 996 | DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document); |
| 997 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 998 | // Function: FPDF_GetNamedDestByName |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 999 | // Get a the destination handle for the given name. |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 1000 | // Parameters: |
| 1001 | // document - Handle to the loaded document. |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 1002 | // name - The name of a destination. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1003 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 1004 | // The handle to the destination. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 1005 | DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, |
| 1006 | FPDF_BYTESTRING name); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1007 | |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 1008 | // Function: FPDF_GetNamedDest |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 1009 | // Get the named destination by index. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 1010 | // Parameters: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 1011 | // document - Handle to a document |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 1012 | // index - The index of a named destination. |
| 1013 | // buffer - The buffer to store the destination name, |
| 1014 | // used as wchar_t*. |
| 1015 | // buflen [in/out] - Size of the buffer in bytes on input, |
| 1016 | // length of the result in bytes on output |
| 1017 | // or -1 if the buffer is too small. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 1018 | // Return value: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 1019 | // The destination handle for a given index, or NULL if there is no |
| 1020 | // named destination corresponding to |index|. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 1021 | // Comments: |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 1022 | // Call this function twice to get the name of the named destination: |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 1023 | // 1) First time pass in |buffer| as NULL and get buflen. |
| 1024 | // 2) Second time pass in allocated |buffer| and buflen to retrieve |
| 1025 | // |buffer|, which should be used as wchar_t*. |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 1026 | // |
Dan Sinclair | 49f88b7 | 2015-10-20 15:18:51 -0400 | [diff] [blame] | 1027 | // If buflen is not sufficiently large, it will be set to -1 upon |
| 1028 | // return. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 1029 | DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, |
| 1030 | int index, |
| 1031 | void* buffer, |
| 1032 | long* buflen); |
Bo Xu | 4d62b6b | 2015-01-10 22:52:59 -0800 | [diff] [blame] | 1033 | |
Tom Sepez | c46d000 | 2015-11-30 15:46:36 -0800 | [diff] [blame] | 1034 | #ifdef PDF_ENABLE_XFA |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 1035 | // Function: FPDF_BStr_Init |
| 1036 | // Helper function to initialize a byte string. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 1037 | DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str); |
| 1038 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 1039 | // Function: FPDF_BStr_Set |
| 1040 | // Helper function to set string data. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 1041 | DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, |
| 1042 | FPDF_LPCSTR bstr, |
| 1043 | int length); |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 1044 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 1045 | // Function: FPDF_BStr_Clear |
| 1046 | // Helper function to clear a byte string. |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 1047 | DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str); |
Tom Sepez | c46d000 | 2015-11-30 15:46:36 -0800 | [diff] [blame] | 1048 | #endif // PDF_ENABLE_XFA |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 1049 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1050 | #ifdef __cplusplus |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 1051 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1052 | #endif |
| 1053 | |
Tom Sepez | 9857e20 | 2015-05-13 17:09:26 -0700 | [diff] [blame] | 1054 | #endif // PUBLIC_FPDFVIEW_H_ |