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