OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 | |
8 #ifndef _FPDFVIEW_H_ | 7 #ifndef _FPDFVIEW_H_ |
9 #define _FPDFVIEW_H_ | 8 #define _FPDFVIEW_H_ |
10 | 9 |
11 #if defined(_WIN32) && !defined(__WINDOWS__) | 10 #if defined(_WIN32) && !defined(__WINDOWS__) |
12 #include <windows.h> | 11 #include <windows.h> |
13 #endif | 12 #endif |
14 | 13 |
15 // Data types | 14 // Data types |
16 typedef void*» FPDF_MODULEMGR; | 15 typedef void* FPDF_MODULEMGR; |
17 | 16 |
18 // PDF types | 17 // PDF types |
19 typedef void*» FPDF_DOCUMENT;» » | 18 typedef void* FPDF_DOCUMENT; |
20 typedef void*» FPDF_PAGE;» » » | 19 typedef void* FPDF_PAGE; |
21 typedef void*» FPDF_PAGEOBJECT;» // Page object(text, path, etc) | 20 typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc) |
22 typedef void*» FPDF_PATH; | 21 typedef void* FPDF_PATH; |
23 typedef void*» FPDF_CLIPPATH;» | 22 typedef void* FPDF_CLIPPATH; |
24 typedef void*» FPDF_BITMAP;» | 23 typedef void* FPDF_BITMAP; |
25 typedef void*» FPDF_FONT;» » » | 24 typedef void* FPDF_FONT; |
26 | 25 |
27 typedef void*» FPDF_TEXTPAGE; | 26 typedef void* FPDF_TEXTPAGE; |
28 typedef void*» FPDF_SCHHANDLE; | 27 typedef void* FPDF_SCHHANDLE; |
29 typedef void*» FPDF_PAGELINK; | 28 typedef void* FPDF_PAGELINK; |
30 typedef void*» FPDF_HMODULE; | 29 typedef void* FPDF_HMODULE; |
31 typedef void*» FPDF_DOCSCHHANDLE; | 30 typedef void* FPDF_DOCSCHHANDLE; |
32 | 31 |
33 typedef void*» FPDF_BOOKMARK; | 32 typedef void* FPDF_BOOKMARK; |
34 typedef void*» FPDF_DEST; | 33 typedef void* FPDF_DEST; |
35 typedef void*» FPDF_ACTION; | 34 typedef void* FPDF_ACTION; |
36 typedef void*» FPDF_LINK; | 35 typedef void* FPDF_LINK; |
37 typedef void* FPDF_PAGERANGE; | 36 typedef void* FPDF_PAGERANGE; |
38 | 37 |
39 // Basic data types | 38 // Basic data types |
40 typedef int» » » » FPDF_BOOL; | 39 typedef int FPDF_BOOL; |
41 typedef int» » » » FPDF_ERROR;» | 40 typedef int FPDF_ERROR; |
42 typedef unsigned long» FPDF_DWORD; | 41 typedef unsigned long FPDF_DWORD; |
43 | 42 |
44 typedef»float» » » FS_FLOAT; | 43 typedef float FS_FLOAT; |
45 | 44 |
46 // Duplex types | 45 // Duplex types |
47 typedef enum _FPDF_DUPLEXTYPE_ { | 46 typedef enum _FPDF_DUPLEXTYPE_ { |
48 DuplexUndefined = 0, | 47 DuplexUndefined = 0, |
49 Simplex, | 48 Simplex, |
50 DuplexFlipShortEdge, | 49 DuplexFlipShortEdge, |
51 DuplexFlipLongEdge | 50 DuplexFlipLongEdge |
52 } FPDF_DUPLEXTYPE; | 51 } FPDF_DUPLEXTYPE; |
53 | 52 |
54 // String types | 53 // String types |
55 typedef unsigned short» » » FPDF_WCHAR; | 54 typedef unsigned short FPDF_WCHAR; |
56 typedef unsigned char const*» FPDF_LPCBYTE; | 55 typedef unsigned char const* FPDF_LPCBYTE; |
57 | 56 |
58 // FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE en
coded), and platform dependent string | 57 // FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE |
59 typedef const char*» » » » FPDF_BYTESTRING; | 58 // encoded), and platform dependent string |
| 59 typedef const char* FPDF_BYTESTRING; |
60 | 60 |
61 typedef const unsigned short*» FPDF_WIDESTRING;» » // Foxit PDF SDK
always use UTF-16LE encoding wide string, | 61 typedef const unsigned short* |
62 » » » » » » » » » »
» » » » // each character use 2 bytes (except surrogatio
n), with low byte first. | 62 FPDF_WIDESTRING; // Foxit PDF SDK always use UTF-16LE encoding wide string, |
| 63 // each character use 2 bytes (except surrogation), with low byte first. |
63 | 64 |
64 // For Windows programmers: for most case it's OK to treat FPDF_WIDESTRING as Wi
ndows unicode string, | 65 // For Windows programmers: for most case it's OK to treat FPDF_WIDESTRING as |
65 //» » however, special care needs to be taken if you expect to proces
s Unicode larger than 0xffff. | 66 // Windows unicode string, |
66 // For Linux/Unix programmers: most compiler/library environment uses 4 bytes fo
r a Unicode character, | 67 //» » however, special care needs to be taken if you expect to proces
s |
67 //» » you have to convert between FPDF_WIDESTRING and system wide stri
ng by yourself. | 68 //Unicode larger than 0xffff. |
| 69 // For Linux/Unix programmers: most compiler/library environment uses 4 bytes |
| 70 // for a Unicode character, |
| 71 //» » you have to convert between FPDF_WIDESTRING and system wide stri
ng |
| 72 //by yourself. |
68 | 73 |
69 #ifdef _WIN32_WCE | 74 #ifdef _WIN32_WCE |
70 typedef const unsigned short* FPDF_STRING; | 75 typedef const unsigned short* FPDF_STRING; |
71 #else | 76 #else |
72 typedef const char* FPDF_STRING; | 77 typedef const char* FPDF_STRING; |
73 #endif | 78 #endif |
74 | 79 |
75 #ifndef _FS_DEF_MATRIX_ | 80 #ifndef _FS_DEF_MATRIX_ |
76 #define _FS_DEF_MATRIX_ | 81 #define _FS_DEF_MATRIX_ |
77 /** @brief Matrix for transformation. */ | 82 /** @brief Matrix for transformation. */ |
78 typedef struct _FS_MATRIX_ | 83 typedef struct _FS_MATRIX_ { |
79 { | 84 float a; /**< @brief Coefficient a.*/ |
80 » float» a;» /**< @brief Coefficient a.*/ | 85 float b; /**< @brief Coefficient b.*/ |
81 » float» b;» /**< @brief Coefficient b.*/ | 86 float c; /**< @brief Coefficient c.*/ |
82 » float» c;» /**< @brief Coefficient c.*/ | 87 float d; /**< @brief Coefficient d.*/ |
83 » float» d;» /**< @brief Coefficient d.*/ | 88 float e; /**< @brief Coefficient e.*/ |
84 » float» e;» /**< @brief Coefficient e.*/ | 89 float f; /**< @brief Coefficient f.*/ |
85 » float» f;» /**< @brief Coefficient f.*/ | |
86 } FS_MATRIX; | 90 } FS_MATRIX; |
87 #endif | 91 #endif |
88 | 92 |
89 #ifndef _FS_DEF_RECTF_ | 93 #ifndef _FS_DEF_RECTF_ |
90 #define _FS_DEF_RECTF_ | 94 #define _FS_DEF_RECTF_ |
91 /** @brief Rectangle area(float) in device or page coordination system. */ | 95 /** @brief Rectangle area(float) in device or page coordination system. */ |
92 typedef struct _FS_RECTF_ | 96 typedef struct _FS_RECTF_ { |
93 { | 97 /**@{*/ |
94 » /**@{*/ | 98 /** @brief The x-coordinate of the left-top corner. */ |
95 » /** @brief The x-coordinate of the left-top corner. */ | 99 float left; |
96 » float» left; | 100 /** @brief The y-coordinate of the left-top corner. */ |
97 » /** @brief The y-coordinate of the left-top corner. */ | 101 float top; |
98 » float» top; | 102 /** @brief The x-coordinate of the right-bottom corner. */ |
99 » /** @brief The x-coordinate of the right-bottom corner. */ | 103 float right; |
100 » float» right; | 104 /** @brief The y-coordinate of the right-bottom corner. */ |
101 » /** @brief The y-coordinate of the right-bottom corner. */ | 105 float bottom; |
102 » float» bottom; | 106 /**@}*/ |
103 » /**@}*/ | |
104 }* FS_LPRECTF, FS_RECTF; | 107 }* FS_LPRECTF, FS_RECTF; |
105 /** @brief Const Pointer to ::FS_RECTF structure.*/ | 108 /** @brief Const Pointer to ::FS_RECTF structure.*/ |
106 typedef const FS_RECTF*»FS_LPCRECTF; | 109 typedef const FS_RECTF* FS_LPCRECTF; |
107 #endif | 110 #endif |
108 | 111 |
109 #if defined(_WIN32) && defined(FPDFSDK_EXPORTS) | 112 #if defined(_WIN32) && defined(FPDFSDK_EXPORTS) |
110 // On Windows system, functions are exported in a DLL | 113 // On Windows system, functions are exported in a DLL |
111 #define DLLEXPORT __declspec( dllexport ) | 114 #define DLLEXPORT __declspec(dllexport) |
112 #define STDCALL __stdcall | 115 #define STDCALL __stdcall |
113 #else | 116 #else |
114 #define DLLEXPORT | 117 #define DLLEXPORT |
115 #define STDCALL | 118 #define STDCALL |
116 #endif | 119 #endif |
117 | 120 |
118 extern const char g_ExpireDate[]; | 121 extern const char g_ExpireDate[]; |
119 extern const char g_ModuleCodes[]; | 122 extern const char g_ModuleCodes[]; |
120 | 123 |
121 // Exported Functions | 124 // Exported Functions |
122 #ifdef __cplusplus | 125 #ifdef __cplusplus |
123 extern "C" { | 126 extern "C" { |
124 #endif | 127 #endif |
125 | 128 |
126 // Function: FPDF_InitLibrary | 129 // Function: FPDF_InitLibrary |
127 //» » » Initialize the FPDFSDK library | 130 //» » » Initialize the FPDFSDK library |
128 // Parameters: | 131 // Parameters: |
129 //» » » hInstance» -» For WIN32 system only: the insta
nce of the executable or DLL module. | 132 //» » » hInstance» -» For WIN32 system only: the insta
nce of |
| 133 //the executable or DLL module. |
130 // Return value: | 134 // Return value: |
131 // None. | 135 // None. |
132 // Comments: | 136 // Comments: |
133 //» » » You have to call this function before you can call any P
DF processing functions. | 137 //» » » You have to call this function before you can call any P
DF |
| 138 //processing functions. |
134 | 139 |
135 DLLEXPORT void STDCALL FPDF_InitLibrary(void* hInstance); | 140 DLLEXPORT void STDCALL FPDF_InitLibrary(void* hInstance); |
136 | 141 |
137 | |
138 // Function: FPDF_DestroyLibary | 142 // Function: FPDF_DestroyLibary |
139 // Release all resources allocated by the FPDFSDK library. | 143 // Release all resources allocated by the FPDFSDK library. |
140 // Parameters: | 144 // Parameters: |
141 // None. | 145 // None. |
142 // Return value: | 146 // Return value: |
143 // None. | 147 // None. |
144 // Comments: | 148 // Comments: |
145 //» » » You can call this function to release all memory blocks
allocated by the library. | 149 //» » » You can call this function to release all memory blocks |
146 //» » » After this function called, you should not call any PDF
processing functions. | 150 //allocated by the library. |
| 151 //» » » After this function called, you should not call any PDF |
| 152 //processing functions. |
147 DLLEXPORT void STDCALL FPDF_DestroyLibrary(); | 153 DLLEXPORT void STDCALL FPDF_DestroyLibrary(); |
148 | 154 |
149 //Policy for accessing the local machine time. | 155 // Policy for accessing the local machine time. |
150 #define FPDF_POLICY_MACHINETIME_ACCESS» 0 | 156 #define FPDF_POLICY_MACHINETIME_ACCESS 0 |
151 | 157 |
152 // Function: FPDF_SetSandBoxPolicy | 158 // Function: FPDF_SetSandBoxPolicy |
153 // Set the policy for the sandbox environment. | 159 // Set the policy for the sandbox environment. |
154 // Parameters:» | 160 // Parameters: |
155 //» » » policy» » -» The specified policy for setting
, for example:FPDF_POLICY_MACHINETIME_ACCESS. | 161 //» » » policy» » -» The specified policy for setting
, |
156 //» » » enable» » -» True for enable, False for disab
le the policy. | 162 //for example:FPDF_POLICY_MACHINETIME_ACCESS. |
| 163 //» » » enable» » -» True for enable, False for disab
le |
| 164 //the policy. |
157 // Return value: | 165 // Return value: |
158 // None. | 166 // None. |
159 DLLEXPORT void» STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enabl
e); | 167 DLLEXPORT void STDCALL |
| 168 FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable); |
160 | 169 |
161 /** | 170 /** |
162 * Open and load a PDF document. | 171 * Open and load a PDF document. |
163 * @param[in] file_path - Path to the PDF file (including extension). | 172 * @param[in] file_path - Path to the PDF file (including extension). |
164 * @param[in] password» -» A string used as the password for PDF file. | 173 * @param[in] password» -» A string used as the password for PDF file. |
165 *» » » » » » » If no password needed, e
mpty or NULL can be used. | 174 *» » » » » » » If no password needed, e
mpty |
| 175 *or NULL can be used. |
166 * @note Loaded document can be closed by FPDF_CloseDocument. | 176 * @note Loaded document can be closed by FPDF_CloseDocument. |
167 *» » » If this function fails, you can use FPDF_GetLastError()
to retrieve | 177 *» » » If this function fails, you can use FPDF_GetLastError()
to |
| 178 *retrieve |
168 * the reason why it fails. | 179 * the reason why it fails. |
169 * @retval A handle to the loaded document. If failed, NULL is returned. | 180 * @retval A handle to the loaded document. If failed, NULL is returned. |
170 */ | 181 */ |
171 DLLEXPORT FPDF_DOCUMENT»STDCALL FPDF_LoadDocument(FPDF_STRING file_path, | 182 DLLEXPORT FPDF_DOCUMENT STDCALL |
172 » FPDF_BYTESTRING password); | 183 FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BYTESTRING password); |
173 | 184 |
174 // Function: FPDF_LoadMemDocument | 185 // Function: FPDF_LoadMemDocument |
175 // Open and load a PDF document from memory. | 186 // Open and load a PDF document from memory. |
176 // Parameters: | 187 // Parameters: |
177 //» » » data_buf» -» Pointer to a buffer containing t
he PDF document. | 188 //» » » data_buf» -» Pointer to a buffer containing t
he PDF |
178 //» » » size» » -» Number of bytes in the PDF docum
ent. | 189 //document. |
179 //» » » password» -» A string used as the password fo
r PDF file. | 190 //» » » size» » -» Number of bytes in the PDF |
180 //» » » » » » » If no password needed, e
mpty or NULL can be used. | 191 //document. |
| 192 //» » » password» -» A string used as the password fo
r PDF |
| 193 //file. |
| 194 //» » » » » » » If no password needed, e
mpty or NULL |
| 195 //can be used. |
181 // Return value: | 196 // Return value: |
182 //» » » A handle to the loaded document. If failed, NULL is retu
rned. | 197 //» » » A handle to the loaded document. If failed, NULL is |
| 198 //returned. |
183 // Comments: | 199 // Comments: |
184 //» » » The memory buffer must remain valid when the document is
open. | 200 //» » » The memory buffer must remain valid when the document is |
| 201 //open. |
185 // Loaded document can be closed by FPDF_CloseDocument. | 202 // Loaded document can be closed by FPDF_CloseDocument. |
186 //» » » If this function fails, you can use FPDF_GetLastError()
to retrieve | 203 //» » » If this function fails, you can use FPDF_GetLastError()
to |
| 204 //retrieve |
187 // the reason why it fails. | 205 // the reason why it fails. |
188 // | 206 // |
189 DLLEXPORT FPDF_DOCUMENT»STDCALL FPDF_LoadMemDocument(const void* data_buf, | 207 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, |
190 » » » » » » » » » »
» int size, FPDF_BYTESTRING password); | 208 int size, |
| 209 FPDF_BYTESTRING password); |
191 | 210 |
192 // Structure for custom file access. | 211 // Structure for custom file access. |
193 typedef struct { | 212 typedef struct { |
194 » // File length, in bytes. | 213 // File length, in bytes. |
195 » unsigned long» m_FileLen; | 214 unsigned long m_FileLen; |
196 | 215 |
197 » // A function pointer for getting a block of data from specific position
. | 216 // A function pointer for getting a block of data from specific position. |
198 » // Position is specified by byte offset from beginning of the file. | 217 // Position is specified by byte offset from beginning of the file. |
199 » // The position and size will never go out range of file length. | 218 // The position and size will never go out range of file length. |
200 » // It may be possible for FPDFSDK to call this function multiple times f
or same position. | 219 // It may be possible for FPDFSDK to call this function multiple times for |
201 » // Return value: should be non-zero if successful, zero for error. | 220 // same position. |
202 » int» » » » (*m_GetBlock)(void* param, unsigned long
position, unsigned char* pBuf, unsigned long size); | 221 // Return value: should be non-zero if successful, zero for error. |
| 222 int (*m_GetBlock)(void* param, |
| 223 unsigned long position, |
| 224 unsigned char* pBuf, |
| 225 unsigned long size); |
203 | 226 |
204 » // A custom pointer for all implementation specific data. | 227 // A custom pointer for all implementation specific data. |
205 » // This pointer will be used as the first parameter to m_GetBlock callba
ck. | 228 // This pointer will be used as the first parameter to m_GetBlock callback. |
206 » void*» » » m_Param; | 229 void* m_Param; |
207 } FPDF_FILEACCESS; | 230 } FPDF_FILEACCESS; |
208 | 231 |
209 // Function: FPDF_LoadCustomDocument | 232 // Function: FPDF_LoadCustomDocument |
210 // Load PDF document from a custom access descriptor. | 233 // Load PDF document from a custom access descriptor. |
211 // Parameters: | 234 // Parameters: |
212 // pFileAccess - A structure for access the file. | 235 // pFileAccess - A structure for access the file. |
213 //» » » password» -» Optional password for decrypting
the PDF file. | 236 //» » » password» -» Optional password for decrypting
the |
| 237 //PDF file. |
214 // Return value: | 238 // Return value: |
215 //» » » A handle to the loaded document. If failed, NULL is retu
rned. | 239 //» » » A handle to the loaded document. If failed, NULL is |
| 240 //returned. |
216 // Comments: | 241 // Comments: |
217 //» » » The application should maintain the file resources being
valid until the PDF document close. | 242 //» » » The application should maintain the file resources being |
| 243 //valid until the PDF document close. |
218 // Loaded document can be closed by FPDF_CloseDocument. | 244 // Loaded document can be closed by FPDF_CloseDocument. |
219 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAc
cess, | 245 DLLEXPORT FPDF_DOCUMENT STDCALL |
220 » » » » » » » » » »
» » » » FPDF_BYTESTRING password); | 246 FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, |
| 247 FPDF_BYTESTRING password); |
221 | 248 |
222 // Function: FPDF_GetFileVersion | 249 // Function: FPDF_GetFileVersion |
223 // Get the file version of the specific PDF document. | 250 // Get the file version of the specific PDF document. |
224 // Parameters: | 251 // Parameters: |
225 // doc - Handle to document. | 252 // doc - Handle to document. |
226 //» » » fileVersion» -» The PDF file version. File versi
on: 14 for 1.4, 15 for 1.5, ... | 253 //» » » fileVersion» -» The PDF file version. File versi
on: |
| 254 //14 for 1.4, 15 for 1.5, ... |
227 // Return value: | 255 // Return value: |
228 // TRUE if this call succeed, If failed, FALSE is returned. | 256 // TRUE if this call succeed, If failed, FALSE is returned. |
229 // Comments: | 257 // Comments: |
230 //» » » If the document is created by function ::FPDF_CreateNewD
ocument, then this function would always fail. | 258 //» » » If the document is created by function |
231 DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, int* fileVers
ion); | 259 //::FPDF_CreateNewDocument, then this function would always fail. |
| 260 DLLEXPORT FPDF_BOOL STDCALL |
| 261 FPDF_GetFileVersion(FPDF_DOCUMENT doc, int* fileVersion); |
232 | 262 |
233 #define FPDF_ERR_SUCCESS» » 0» » // No error. | 263 #define FPDF_ERR_SUCCESS 0 // No error. |
234 #define FPDF_ERR_UNKNOWN» » 1» » // Unknown error. | 264 #define FPDF_ERR_UNKNOWN 1 // Unknown error. |
235 #define FPDF_ERR_FILE» » » 2» » // File not found or cou
ld not be opened. | 265 #define FPDF_ERR_FILE 2 // File not found or could not be opened. |
236 #define FPDF_ERR_FORMAT»» » 3» » // File not in PDF forma
t or corrupted. | 266 #define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted. |
237 #define FPDF_ERR_PASSWORD» » 4» » // Password required or
incorrect password. | 267 #define FPDF_ERR_PASSWORD 4 // Password required or incorrect password. |
238 #define FPDF_ERR_SECURITY» » 5» » // Unsupported security
scheme. | 268 #define FPDF_ERR_SECURITY 5 // Unsupported security scheme. |
239 #define FPDF_ERR_PAGE» » » 6» » // Page not found or con
tent error. | 269 #define FPDF_ERR_PAGE 6 // Page not found or content error. |
240 | 270 |
241 // Function: FPDF_GetLastError | 271 // Function: FPDF_GetLastError |
242 // Get last error code when an SDK function failed. | 272 // Get last error code when an SDK function failed. |
243 // Parameters: | 273 // Parameters: |
244 // None. | 274 // None. |
245 // Return value: | 275 // Return value: |
246 // A 32-bit integer indicating error codes (defined above). | 276 // A 32-bit integer indicating error codes (defined above). |
247 // Comments: | 277 // Comments: |
248 //» » » If the previous SDK call succeeded, the return value of
this function | 278 //» » » If the previous SDK call succeeded, the return value of
this |
| 279 //function |
249 // is not defined. | 280 // is not defined. |
250 // | 281 // |
251 DLLEXPORT unsigned long»STDCALL FPDF_GetLastError(); | 282 DLLEXPORT unsigned long STDCALL FPDF_GetLastError(); |
252 | 283 |
253 // Function: FPDF_GetDocPermission | 284 // Function: FPDF_GetDocPermission |
254 // Get file permission flags of the document. | 285 // Get file permission flags of the document. |
255 // Parameters: | 286 // Parameters: |
256 //» » » document» -» Handle to document. Returned by
FPDF_LoadDocument function. | 287 //» » » document» -» Handle to document. Returned by |
| 288 //FPDF_LoadDocument function. |
257 // Return value: | 289 // Return value: |
258 //» » » A 32-bit integer indicating permission flags. Please ref
er to PDF Reference for | 290 //» » » A 32-bit integer indicating permission flags. Please ref
er |
259 //» » » detailed description. If the document is not protected,
0xffffffff will be returned. | 291 //to PDF Reference for |
| 292 //» » » detailed description. If the document is not protected, |
| 293 //0xffffffff will be returned. |
260 // | 294 // |
261 DLLEXPORT unsigned long»STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); | 295 DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); |
262 | 296 |
263 // Function: FPDF_GetPageCount | 297 // Function: FPDF_GetPageCount |
264 // Get total number of pages in a document. | 298 // Get total number of pages in a document. |
265 // Parameters: | 299 // Parameters: |
266 //» » » document» -» Handle to document. Returned by
FPDF_LoadDocument function. | 300 //» » » document» -» Handle to document. Returned by |
| 301 //FPDF_LoadDocument function. |
267 // Return value: | 302 // Return value: |
268 // Total number of pages in the document. | 303 // Total number of pages in the document. |
269 // | 304 // |
270 DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); | 305 DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); |
271 | 306 |
272 // Function: FPDF_LoadPage | 307 // Function: FPDF_LoadPage |
273 // Load a page inside a document. | 308 // Load a page inside a document. |
274 // Parameters: | 309 // Parameters: |
275 //» » » document» -» Handle to document. Returned by
FPDF_LoadDocument function. | 310 //» » » document» -» Handle to document. Returned by |
276 //» » » page_index» -» Index number of the page. 0 for
the first page. | 311 //FPDF_LoadDocument function. |
| 312 //» » » page_index» -» Index number of the page. 0 for
the |
| 313 //first page. |
277 // Return value: | 314 // Return value: |
278 //» » » A handle to the loaded page. If failed, NULL is returned
. | 315 //» » » A handle to the loaded page. If failed, NULL is |
| 316 //returned. |
279 // Comments: | 317 // Comments: |
280 //» » » Loaded page can be rendered to devices using FPDF_Render
Page function. | 318 //» » » Loaded page can be rendered to devices using FPDF_Render
Page |
| 319 //function. |
281 // Loaded page can be closed by FPDF_ClosePage. | 320 // Loaded page can be closed by FPDF_ClosePage. |
282 // | 321 // |
283 DLLEXPORT FPDF_PAGE» STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, int page_i
ndex); | 322 DLLEXPORT FPDF_PAGE STDCALL |
| 323 FPDF_LoadPage(FPDF_DOCUMENT document, int page_index); |
284 | 324 |
285 // Function: FPDF_GetPageWidth | 325 // Function: FPDF_GetPageWidth |
286 // Get page width. | 326 // Get page width. |
287 // Parameters: | 327 // Parameters: |
288 //» » » page» » -» Handle to the page. Returned by
FPDF_LoadPage function. | 328 //» » » page» » -» Handle to the page. Returned by |
| 329 //FPDF_LoadPage function. |
289 // Return value: | 330 // Return value: |
290 //» » » Page width (excluding non-displayable area) measured in
points. | 331 //» » » Page width (excluding non-displayable area) measured in |
| 332 //points. |
291 // One point is 1/72 inch (around 0.3528 mm). | 333 // One point is 1/72 inch (around 0.3528 mm). |
292 // | 334 // |
293 DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); | 335 DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); |
294 | 336 |
295 // Function: FPDF_GetPageHeight | 337 // Function: FPDF_GetPageHeight |
296 // Get page height. | 338 // Get page height. |
297 // Parameters: | 339 // Parameters: |
298 //» » » page» » -» Handle to the page. Returned by
FPDF_LoadPage function. | 340 //» » » page» » -» Handle to the page. Returned by |
| 341 //FPDF_LoadPage function. |
299 // Return value: | 342 // Return value: |
300 //» » » Page height (excluding non-displayable area) measured in
points. | 343 //» » » Page height (excluding non-displayable area) measured in |
| 344 //points. |
301 // One point is 1/72 inch (around 0.3528 mm) | 345 // One point is 1/72 inch (around 0.3528 mm) |
302 // | 346 // |
303 DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); | 347 DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); |
304 | 348 |
305 // Function: FPDF_GetPageSizeByIndex | 349 // Function: FPDF_GetPageSizeByIndex |
306 // Get the size of a page by index. | 350 // Get the size of a page by index. |
307 // Parameters: | 351 // Parameters: |
308 //» » » document» -» Handle to document. Returned by
FPDF_LoadDocument function. | 352 //» » » document» -» Handle to document. Returned by |
309 //» » » page_index» -» Page index, zero for the first p
age. | 353 //FPDF_LoadDocument function. |
310 //» » » width» » -» Pointer to a double value receiv
ing the page width (in points). | 354 //» » » page_index» -» Page index, zero for the first |
311 //» » » height» » -» Pointer to a double value receiv
ing the page height (in points). | 355 //page. |
| 356 //» » » width» » -» Pointer to a double value receiv
ing |
| 357 //the page width (in points). |
| 358 //» » » height» » -» Pointer to a double value receiv
ing |
| 359 //the page height (in points). |
312 // Return value: | 360 // Return value: |
313 //» » » Non-zero for success. 0 for error (document or page not
found). | 361 //» » » Non-zero for success. 0 for error (document or page not |
| 362 //found). |
314 // | 363 // |
315 DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_i
ndex, double* width, double* height); | 364 DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, |
316 | 365 int page_index, |
| 366 double* width, |
| 367 double* height); |
317 | 368 |
318 // Page rendering flags. They can be combined with bit OR. | 369 // Page rendering flags. They can be combined with bit OR. |
319 #define FPDF_ANNOT» » » 0x01» » // Set if annotations ar
e to be rendered. | 370 #define FPDF_ANNOT 0x01 // Set if annotations are to be rendered. |
320 #define FPDF_LCD_TEXT» » 0x02» » // Set if using text rendering o
ptimized for LCD display. | 371 #define FPDF_LCD_TEXT \ |
321 #define FPDF_NO_NATIVETEXT» 0x04» » // Don't use the native text out
put available on some platforms | 372 0x02 // Set if using text rendering optimized for LCD display. |
322 #define FPDF_GRAYSCALE» » 0x08» » // Grayscale output. | 373 #define FPDF_NO_NATIVETEXT \ |
323 #define FPDF_DEBUG_INFO»» 0x80» » // Set if you want to get some d
ebug info. | 374 0x04 // Don't use the native text output available on some platforms |
324 » » » » » » » » » »
// Please discuss with Foxit first if you need to collect debug info. | 375 #define FPDF_GRAYSCALE 0x08 // Grayscale output. |
325 #define FPDF_NO_CATCH» » 0x100» » // Set if you don't want to catc
h exception. | 376 #define FPDF_DEBUG_INFO 0x80 // Set if you want to get some debug info. |
326 #define FPDF_RENDER_LIMITEDIMAGECACHE» 0x200» // Limit image cache size. | 377 // Please discuss with Foxit first if you need to collect debug info. |
327 #define FPDF_RENDER_FORCEHALFTONE» » 0x400» // Always use halftone f
or image stretching. | 378 #define FPDF_NO_CATCH 0x100 // Set if you don't want to catch exception. |
328 #define FPDF_PRINTING» » 0x800» // Render for printing. | 379 #define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 // Limit image cache size. |
329 #define FPDF_REVERSE_BYTE_ORDER»» 0x10» » //set whether render in
a reverse Byte order, this flag only | 380 #define FPDF_RENDER_FORCEHALFTONE \ |
330 » » » » » » » » » »
» » //enable when render to a bitmap. | 381 0x400 // Always use halftone for image stretching. |
| 382 #define FPDF_PRINTING 0x800 // Render for printing. |
| 383 #define FPDF_REVERSE_BYTE_ORDER \ |
| 384 0x10 // set whether render in a reverse Byte order, this flag only |
| 385 // enable when render to a bitmap. |
331 #ifdef _WIN32 | 386 #ifdef _WIN32 |
332 // Function: FPDF_RenderPage | 387 // Function: FPDF_RenderPage |
333 //» » » Render contents in a page to a device (screen, bitmap, o
r printer). | 388 //» » » Render contents in a page to a device (screen, bitmap, o
r |
| 389 //printer). |
334 // This function is only supported on Windows system. | 390 // This function is only supported on Windows system. |
335 // Parameters: | 391 // Parameters: |
336 //» » » dc» » » -» Handle to device context
. | 392 //» » » dc» » » -» Handle to device |
337 //» » » page» » -» Handle to the page. Returned by
FPDF_LoadPage function. | 393 //context. |
338 //» » » start_x»» -» Left pixel position of the displ
ay area in the device coordinate. | 394 //» » » page» » -» Handle to the page. Returned by |
339 //» » » start_y»» -» Top pixel position of the displa
y area in the device coordinate. | 395 //FPDF_LoadPage function. |
340 //» » » size_x» » -» Horizontal size (in pixels) for
displaying the page. | 396 //» » » start_x»» -» Left pixel position of the displ
ay |
341 //» » » size_y» » -» Vertical size (in pixels) for di
splaying the page. | 397 //area in the device coordinate. |
342 //» » » rotate» » -» Page orientation: 0 (normal), 1
(rotated 90 degrees clockwise), | 398 //» » » start_y»» -» Top pixel position of the displa
y |
343 //» » » » » » » » 2 (rotated 180 d
egrees), 3 (rotated 90 degrees counter-clockwise). | 399 //area in the device coordinate. |
344 //» » » flags» » -» 0 for normal display, or combina
tion of flags defined above. | 400 //» » » size_x» » -» Horizontal size (in pixels) for |
| 401 //displaying the page. |
| 402 //» » » size_y» » -» Vertical size (in pixels) for |
| 403 //displaying the page. |
| 404 //» » » rotate» » -» Page orientation: 0 (normal), 1 |
| 405 //(rotated 90 degrees clockwise), |
| 406 //» » » » » » » » 2 (rotated 180 d
egrees), 3 |
| 407 //(rotated 90 degrees counter-clockwise). |
| 408 //» » » flags» » -» 0 for normal display, or combina
tion |
| 409 //of flags defined above. |
345 // Return value: | 410 // Return value: |
346 // None. | 411 // None. |
347 // | 412 // |
348 DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int
start_y, int size_x, int size_y, | 413 DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, |
349 » » » » » » int rotate, int flags); | 414 FPDF_PAGE page, |
| 415 int start_x, |
| 416 int start_y, |
| 417 int size_x, |
| 418 int size_y, |
| 419 int rotate, |
| 420 int flags); |
350 #endif | 421 #endif |
351 | 422 |
352 // Function: FPDF_RenderPageBitmap | 423 // Function: FPDF_RenderPageBitmap |
353 // Render contents in a page to a device independent bitmap | 424 // Render contents in a page to a device independent bitmap |
354 // Parameters: | 425 // Parameters: |
355 //» » » bitmap» » -» Handle to the device independent
bitmap (as the output buffer). | 426 //» » » bitmap» » -» Handle to the device independent |
356 //» » » » » » » Bitmap handle can be cre
ated by FPDFBitmap_Create function. | 427 //bitmap (as the output buffer). |
357 //» » » page» » -» Handle to the page. Returned by
FPDF_LoadPage function. | 428 //» » » » » » » Bitmap handle can be cre
ated by |
358 //» » » start_x»» -» Left pixel position of the displ
ay area in the bitmap coordinate. | 429 //FPDFBitmap_Create function. |
359 //» » » start_y»» -» Top pixel position of the displa
y area in the bitmap coordinate. | 430 //» » » page» » -» Handle to the page. Returned by |
360 //» » » size_x» » -» Horizontal size (in pixels) for
displaying the page. | 431 //FPDF_LoadPage function. |
361 //» » » size_y» » -» Vertical size (in pixels) for di
splaying the page. | 432 //» » » start_x»» -» Left pixel position of the displ
ay |
362 //» » » rotate» » -» Page orientation: 0 (normal), 1
(rotated 90 degrees clockwise), | 433 //area in the bitmap coordinate. |
363 //» » » » » » » » 2 (rotated 180 d
egrees), 3 (rotated 90 degrees counter-clockwise). | 434 //» » » start_y»» -» Top pixel position of the displa
y |
364 //» » » flags» » -» 0 for normal display, or combina
tion of flags defined above. | 435 //area in the bitmap coordinate. |
| 436 //» » » size_x» » -» Horizontal size (in pixels) for |
| 437 //displaying the page. |
| 438 //» » » size_y» » -» Vertical size (in pixels) for |
| 439 //displaying the page. |
| 440 //» » » rotate» » -» Page orientation: 0 (normal), 1 |
| 441 //(rotated 90 degrees clockwise), |
| 442 //» » » » » » » » 2 (rotated 180 d
egrees), 3 |
| 443 //(rotated 90 degrees counter-clockwise). |
| 444 //» » » flags» » -» 0 for normal display, or combina
tion |
| 445 //of flags defined above. |
365 // Return value: | 446 // Return value: |
366 // None. | 447 // None. |
367 // | 448 // |
368 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page,
int start_x, int start_y, | 449 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, |
369 » » » » » » int size_x, int size_y, int rota
te, int flags); | 450 FPDF_PAGE page, |
| 451 int start_x, |
| 452 int start_y, |
| 453 int size_x, |
| 454 int size_y, |
| 455 int rotate, |
| 456 int flags); |
370 | 457 |
371 // Function: FPDF_ClosePage | 458 // Function: FPDF_ClosePage |
372 // Close a loaded PDF page. | 459 // Close a loaded PDF page. |
373 // Parameters: | 460 // Parameters: |
374 // page - Handle to the loaded page. | 461 // page - Handle to the loaded page. |
375 // Return value: | 462 // Return value: |
376 // None. | 463 // None. |
377 // | 464 // |
378 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); | 465 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); |
379 | 466 |
380 // Function: FPDF_CloseDocument | 467 // Function: FPDF_CloseDocument |
381 // Close a loaded PDF document. | 468 // Close a loaded PDF document. |
382 // Parameters: | 469 // Parameters: |
383 // document - Handle to the loaded document. | 470 // document - Handle to the loaded document. |
384 // Return value: | 471 // Return value: |
385 // None. | 472 // None. |
386 // | 473 // |
387 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); | 474 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); |
388 | 475 |
389 // Function: FPDF_DeviceToPage | 476 // Function: FPDF_DeviceToPage |
390 //» » » Convert the screen coordinate of a point to page coordin
ate. | 477 //» » » Convert the screen coordinate of a point to page |
391 // Parameters: | 478 //coordinate. |
392 //» » » page» » -» Handle to the page. Returned by
FPDF_LoadPage function. | 479 // Parameters: |
393 //» » » start_x»» -» Left pixel position of the displ
ay area in the device coordinate. | 480 //» » » page» » -» Handle to the page. Returned by |
394 //» » » start_y»» -» Top pixel position of the displa
y area in the device coordinate. | 481 //FPDF_LoadPage function. |
395 //» » » size_x» » -» Horizontal size (in pixels) for
displaying the page. | 482 //» » » start_x»» -» Left pixel position of the displ
ay |
396 //» » » size_y» » -» Vertical size (in pixels) for di
splaying the page. | 483 //area in the device coordinate. |
397 //» » » rotate» » -» Page orientation: 0 (normal), 1
(rotated 90 degrees clockwise), | 484 //» » » start_y»» -» Top pixel position of the displa
y |
398 //» » » » » » » » 2 (rotated 180 d
egrees), 3 (rotated 90 degrees counter-clockwise). | 485 //area in the device coordinate. |
399 //» » » device_x» -» X value in device coordinate, fo
r the point to be converted. | 486 //» » » size_x» » -» Horizontal size (in pixels) for |
400 //» » » device_y» -» Y value in device coordinate, fo
r the point to be converted. | 487 //displaying the page. |
401 //» » » page_x» » -» A Pointer to a double receiving
the converted X value in page coordinate. | 488 //» » » size_y» » -» Vertical size (in pixels) for |
402 //» » » page_y» » -» A Pointer to a double receiving
the converted Y value in page coordinate. | 489 //displaying the page. |
| 490 //» » » rotate» » -» Page orientation: 0 (normal), 1 |
| 491 //(rotated 90 degrees clockwise), |
| 492 //» » » » » » » » 2 (rotated 180 d
egrees), 3 |
| 493 //(rotated 90 degrees counter-clockwise). |
| 494 //» » » device_x» -» X value in device coordinate, fo
r the |
| 495 //point to be converted. |
| 496 //» » » device_y» -» Y value in device coordinate, fo
r the |
| 497 //point to be converted. |
| 498 //» » » page_x» » -» A Pointer to a double receiving
the |
| 499 //converted X value in page coordinate. |
| 500 //» » » page_y» » -» A Pointer to a double receiving
the |
| 501 //converted Y value in page coordinate. |
403 // Return value: | 502 // Return value: |
404 // None. | 503 // None. |
405 // Comments: | 504 // Comments: |
406 //» » » The page coordinate system has its origin at left-bottom
corner of the page, with X axis goes along | 505 //» » » The page coordinate system has its origin at left-bottom |
407 //» » » the bottom side to the right, and Y axis goes along the
left side upward. NOTE: this coordinate system | 506 //corner of the page, with X axis goes along |
408 //» » » can be altered when you zoom, scroll, or rotate a page,
however, a point on the page should always have | 507 //» » » the bottom side to the right, and Y axis goes along the
left |
409 //» » » the same coordinate values in the page coordinate system
. | 508 //side upward. NOTE: this coordinate system |
410 // | 509 //» » » can be altered when you zoom, scroll, or rotate a page, |
411 //» » » The device coordinate system is device dependent. For sc
reen device, its origin is at left-top | 510 //however, a point on the page should always have |
412 //» » » corner of the window. However this origin can be altered
by Windows coordinate transformation | 511 //» » » the same coordinate values in the page coordinate |
413 //» » » utilities. You must make sure the start_x, start_y, size
_x, size_y and rotate parameters have exactly | 512 //system. |
414 //» » » same values as you used in FPDF_RenderPage() function ca
ll. | 513 // |
415 // | 514 //» » » The device coordinate system is device dependent. For sc
reen |
416 DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, int start_x, int start_
y, int size_x, int size_y, | 515 //device, its origin is at left-top |
417 » » » » » » int rotate, int device_x, int de
vice_y, double* page_x, double* page_y); | 516 //» » » corner of the window. However this origin can be altered
by |
| 517 //Windows coordinate transformation |
| 518 //» » » utilities. You must make sure the start_x, start_y, size
_x, |
| 519 //size_y and rotate parameters have exactly |
| 520 //» » » same values as you used in FPDF_RenderPage() function |
| 521 //call. |
| 522 // |
| 523 DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, |
| 524 int start_x, |
| 525 int start_y, |
| 526 int size_x, |
| 527 int size_y, |
| 528 int rotate, |
| 529 int device_x, |
| 530 int device_y, |
| 531 double* page_x, |
| 532 double* page_y); |
418 | 533 |
419 // Function: FPDF_PageToDevice | 534 // Function: FPDF_PageToDevice |
420 //» » » Convert the page coordinate of a point to screen coordin
ate. | 535 //» » » Convert the page coordinate of a point to screen |
421 // Parameters: | 536 //coordinate. |
422 //» » » page» » -» Handle to the page. Returned by
FPDF_LoadPage function. | 537 // Parameters: |
423 //» » » start_x»» -» Left pixel position of the displ
ay area in the device coordinate. | 538 //» » » page» » -» Handle to the page. Returned by |
424 //» » » start_y»» -» Top pixel position of the displa
y area in the device coordinate. | 539 //FPDF_LoadPage function. |
425 //» » » size_x» » -» Horizontal size (in pixels) for
displaying the page. | 540 //» » » start_x»» -» Left pixel position of the displ
ay |
426 //» » » size_y» » -» Vertical size (in pixels) for di
splaying the page. | 541 //area in the device coordinate. |
427 //» » » rotate» » -» Page orientation: 0 (normal), 1
(rotated 90 degrees clockwise), | 542 //» » » start_y»» -» Top pixel position of the displa
y |
428 //» » » » » » » » 2 (rotated 180 d
egrees), 3 (rotated 90 degrees counter-clockwise). | 543 //area in the device coordinate. |
429 //» » » page_x» » -» X value in page coordinate, for
the point to be converted. | 544 //» » » size_x» » -» Horizontal size (in pixels) for |
430 //» » » page_y» » -» Y value in page coordinate, for
the point to be converted. | 545 //displaying the page. |
431 //» » » device_x» -» A pointer to an integer receivin
g the result X value in device coordinate. | 546 //» » » size_y» » -» Vertical size (in pixels) for |
432 //» » » device_y» -» A pointer to an integer receivin
g the result Y value in device coordinate. | 547 //displaying the page. |
| 548 //» » » rotate» » -» Page orientation: 0 (normal), 1 |
| 549 //(rotated 90 degrees clockwise), |
| 550 //» » » » » » » » 2 (rotated 180 d
egrees), 3 |
| 551 //(rotated 90 degrees counter-clockwise). |
| 552 //» » » page_x» » -» X value in page coordinate, for
the |
| 553 //point to be converted. |
| 554 //» » » page_y» » -» Y value in page coordinate, for
the |
| 555 //point to be converted. |
| 556 //» » » device_x» -» A pointer to an integer receivin
g the |
| 557 //result X value in device coordinate. |
| 558 //» » » device_y» -» A pointer to an integer receivin
g the |
| 559 //result Y value in device coordinate. |
433 // Return value: | 560 // Return value: |
434 // None. | 561 // None. |
435 // Comments: | 562 // Comments: |
436 // See comments of FPDF_DeviceToPage() function. | 563 // See comments of FPDF_DeviceToPage() function. |
437 // | 564 // |
438 DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, int start_x, int start_
y, int size_x, int size_y, | 565 DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, |
439 » » » » » » int rotate, double page_x, doubl
e page_y, int* device_x, int* device_y); | 566 int start_x, |
| 567 int start_y, |
| 568 int size_x, |
| 569 int size_y, |
| 570 int rotate, |
| 571 double page_x, |
| 572 double page_y, |
| 573 int* device_x, |
| 574 int* device_y); |
440 | 575 |
441 // Function: FPDFBitmap_Create | 576 // Function: FPDFBitmap_Create |
442 // Create a Foxit Device Independent Bitmap (FXDIB). | 577 // Create a Foxit Device Independent Bitmap (FXDIB). |
443 // Parameters: | 578 // Parameters: |
444 //» » » width» » -» Number of pixels in a horizontal
line of the bitmap. Must be greater than 0. | 579 //» » » width» » -» Number of pixels in a horizontal |
445 //» » » height» » -» Number of pixels in a vertical l
ine of the bitmap. Must be greater than 0. | 580 //line of the bitmap. Must be greater than 0. |
446 //» » » alpha» » -» A flag indicating whether alpha
channel is used. Non-zero for using alpha, zero for not using. | 581 //» » » height» » -» Number of pixels in a vertical l
ine |
447 // Return value: | 582 //of the bitmap. Must be greater than 0. |
448 //» » » The created bitmap handle, or NULL if parameter error or
out of memory. | 583 //» » » alpha» » -» A flag indicating whether alpha |
449 // Comments: | 584 //channel is used. Non-zero for using alpha, zero for not using. |
450 //» » » An FXDIB always use 4 byte per pixel. The first byte of
a pixel is always double word aligned. | 585 // Return value: |
451 //» » » Each pixel contains red (R), green (G), blue (B) and opt
ionally alpha (A) values. | 586 //» » » The created bitmap handle, or NULL if parameter error or
out |
452 //» » » The byte order is BGRx (the last byte unused if no alpha
channel) or BGRA. | 587 //of memory. |
453 //» » » | 588 // Comments: |
454 //» » » The pixels in a horizontal line (also called scan line)
are stored side by side, with left most | 589 //» » » An FXDIB always use 4 byte per pixel. The first byte of
a |
455 //» » » pixel stored first (with lower memory address). Each sca
n line uses width*4 bytes. | 590 //pixel is always double word aligned. |
456 // | 591 //» » » Each pixel contains red (R), green (G), blue (B) and |
457 //» » » Scan lines are stored one after another, with top most s
can line stored first. There is no gap | 592 //optionally alpha (A) values. |
| 593 //» » » The byte order is BGRx (the last byte unused if no alpha |
| 594 //channel) or BGRA. |
| 595 // |
| 596 //» » » The pixels in a horizontal line (also called scan line)
are |
| 597 //stored side by side, with left most |
| 598 //» » » pixel stored first (with lower memory address). Each sca
n |
| 599 //line uses width*4 bytes. |
| 600 // |
| 601 //» » » Scan lines are stored one after another, with top most s
can |
| 602 //line stored first. There is no gap |
458 // between adjacent scan lines. | 603 // between adjacent scan lines. |
459 // | 604 // |
460 //» » » This function allocates enough memory for holding all pi
xels in the bitmap, but it doesn't | 605 //» » » This function allocates enough memory for holding all pi
xels |
461 //» » » initialize the buffer. Applications can use FPDFBitmap_F
illRect to fill the bitmap using any color. | 606 //in the bitmap, but it doesn't |
462 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha
); | 607 //» » » initialize the buffer. Applications can use |
| 608 //FPDFBitmap_FillRect to fill the bitmap using any color. |
| 609 DLLEXPORT FPDF_BITMAP STDCALL |
| 610 FPDFBitmap_Create(int width, int height, int alpha); |
463 | 611 |
464 // More DIB formats | 612 // More DIB formats |
465 #define FPDFBitmap_Gray»» 1» » // Gray scale bitmap, one byte p
er pixel. | 613 #define FPDFBitmap_Gray 1 // Gray scale bitmap, one byte per pixel. |
466 #define FPDFBitmap_BGR» » 2» » // 3 bytes per pixel, byte order
: blue, green, red. | 614 #define FPDFBitmap_BGR 2 // 3 bytes per pixel, byte order: blue, green, red. |
467 #define FPDFBitmap_BGRx»» 3» » // 4 bytes per pixel, byte order
: blue, green, red, unused. | 615 #define FPDFBitmap_BGRx \ |
468 #define FPDFBitmap_BGRA»» 4» » // 4 bytes per pixel, byte order
: blue, green, red, alpha. | 616 3 // 4 bytes per pixel, byte order: blue, green, red, unused. |
| 617 #define FPDFBitmap_BGRA \ |
| 618 4 // 4 bytes per pixel, byte order: blue, green, red, alpha. |
469 | 619 |
470 // Function: FPDFBitmap_CreateEx | 620 // Function: FPDFBitmap_CreateEx |
471 // Create a Foxit Device Independent Bitmap (FXDIB) | 621 // Create a Foxit Device Independent Bitmap (FXDIB) |
472 // Parameters: | 622 // Parameters: |
473 //» » » width» » -» Number of pixels in a horizontal
line of the bitmap. Must be greater than 0. | 623 //» » » width» » -» Number of pixels in a horizontal |
474 //» » » height» » -» Number of pixels in a vertical l
ine of the bitmap. Must be greater than 0. | 624 //line of the bitmap. Must be greater than 0. |
475 //» » » format» » -» A number indicating for bitmap f
ormat, as defined above. | 625 //» » » height» » -» Number of pixels in a vertical l
ine |
476 //» » » first_scan» -» A pointer to the first byte of f
irst scan line, for external buffer | 626 //of the bitmap. Must be greater than 0. |
477 //» » » » » » » only. If this parameter
is NULL, then the SDK will create its own buffer. | 627 //» » » format» » -» A number indicating for bitmap |
478 //» » » stride» » -» Number of bytes for each scan li
ne, for external buffer only.. | 628 //format, as defined above. |
479 // Return value: | 629 //» » » first_scan» -» A pointer to the first byte of f
irst |
480 //» » » The created bitmap handle, or NULL if parameter error or
out of memory. | 630 //scan line, for external buffer |
481 // Comments: | 631 //» » » » » » » only. If this parameter
is NULL, |
482 //» » » Similar to FPDFBitmap_Create function, with more formats
and external buffer supported. | 632 //then the SDK will create its own buffer. |
483 //» » » Bitmap created by this function can be used in any place
that a FPDF_BITMAP handle is | 633 //» » » stride» » -» Number of bytes for each scan li
ne, |
484 //» » » required. | 634 //for external buffer only.. |
485 // | 635 // Return value: |
486 //» » » If external scanline buffer is used, then the applicatio
n should destroy the buffer | 636 //» » » The created bitmap handle, or NULL if parameter error or
out |
487 //» » » by itself. FPDFBitmap_Destroy function will not destroy
the buffer. | 637 //of memory. |
488 // | 638 // Comments: |
489 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int for
mat, void* first_scan, int stride); | 639 //» » » Similar to FPDFBitmap_Create function, with more formats
and |
| 640 //external buffer supported. |
| 641 //» » » Bitmap created by this function can be used in any place |
| 642 //that a FPDF_BITMAP handle is |
| 643 //» » » required. |
| 644 // |
| 645 //» » » If external scanline buffer is used, then the applicatio
n |
| 646 //should destroy the buffer |
| 647 //» » » by itself. FPDFBitmap_Destroy function will not destroy
the |
| 648 //buffer. |
| 649 // |
| 650 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, |
| 651 int height, |
| 652 int format, |
| 653 void* first_scan, |
| 654 int stride); |
490 | 655 |
491 // Function: FPDFBitmap_FillRect | 656 // Function: FPDFBitmap_FillRect |
492 // Fill a rectangle area in an FXDIB. | 657 // Fill a rectangle area in an FXDIB. |
493 // Parameters: | 658 // Parameters: |
494 //» » » bitmap» » -» The handle to the bitmap. Return
ed by FPDFBitmap_Create function. | 659 //» » » bitmap» » -» The handle to the bitmap. Return
ed |
495 //» » » left» » -» The left side position. Starting
from 0 at the left-most pixel. | 660 //by FPDFBitmap_Create function. |
496 //» » » top» » » -» The top side position. S
tarting from 0 at the top-most scan line. | 661 //» » » left» » -» The left side position. Starting
from |
497 //» » » width» » -» Number of pixels to be filled in
each scan line. | 662 //0 at the left-most pixel. |
498 //» » » height» » -» Number of scan lines to be fille
d. | 663 //» » » top» » » -» The top side position. S
tarting |
499 //» » » color» » -» A 32-bit value specifing the col
or, in 8888 ARGB format. | 664 //from 0 at the top-most scan line. |
| 665 //» » » width» » -» Number of pixels to be filled in |
| 666 //each scan line. |
| 667 //» » » height» » -» Number of scan lines to be |
| 668 //filled. |
| 669 //» » » color» » -» A 32-bit value specifing the col
or, |
| 670 //in 8888 ARGB format. |
500 // Return value: | 671 // Return value: |
501 // None. | 672 // None. |
502 // Comments: | 673 // Comments: |
503 //» » » This function set the color and (optionally) alpha value
in specified region of the bitmap. | 674 //» » » This function set the color and (optionally) alpha value
in |
504 //» » » NOTE: If alpha channel is used, this function does NOT c
omposite the background with the source color, | 675 //specified region of the bitmap. |
505 //» » » instead the background will be replaced by the source co
lor and alpha. | 676 //» » » NOTE: If alpha channel is used, this function does NOT |
506 //» » » If alpha channel is not used, the "alpha" parameter is i
gnored. | 677 //composite the background with the source color, |
507 // | 678 //» » » instead the background will be replaced by the source co
lor |
508 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top
, int width, int height, FPDF_DWORD color); | 679 //and alpha. |
| 680 //» » » If alpha channel is not used, the "alpha" parameter is |
| 681 //ignored. |
| 682 // |
| 683 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, |
| 684 int left, |
| 685 int top, |
| 686 int width, |
| 687 int height, |
| 688 FPDF_DWORD color); |
509 | 689 |
510 // Function: FPDFBitmap_GetBuffer | 690 // Function: FPDFBitmap_GetBuffer |
511 // Get data buffer of an FXDIB | 691 // Get data buffer of an FXDIB |
512 // Parameters: | 692 // Parameters: |
513 //» » » bitmap» » -» Handle to the bitmap. Returned b
y FPDFBitmap_Create function. | 693 //» » » bitmap» » -» Handle to the bitmap. Returned b
y |
| 694 //FPDFBitmap_Create function. |
514 // Return value: | 695 // Return value: |
515 // The pointer to the first byte of the bitmap buffer. | 696 // The pointer to the first byte of the bitmap buffer. |
516 // Comments: | 697 // Comments: |
517 //» » » The stride may be more than width * number of bytes per
pixel | 698 //» » » The stride may be more than width * number of bytes per |
518 //» » » Applications can use this function to get the bitmap buf
fer pointer, then manipulate any color | 699 //pixel |
| 700 //» » » Applications can use this function to get the bitmap buf
fer |
| 701 //pointer, then manipulate any color |
519 // and/or alpha values for any pixels in the bitmap. | 702 // and/or alpha values for any pixels in the bitmap. |
520 DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); | 703 DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); |
521 | 704 |
522 // Function: FPDFBitmap_GetWidth | 705 // Function: FPDFBitmap_GetWidth |
523 // Get width of an FXDIB. | 706 // Get width of an FXDIB. |
524 // Parameters: | 707 // Parameters: |
525 //» » » bitmap» » -» Handle to the bitmap. Returned b
y FPDFBitmap_Create function. | 708 //» » » bitmap» » -» Handle to the bitmap. Returned b
y |
| 709 //FPDFBitmap_Create function. |
526 // Return value: | 710 // Return value: |
527 // The number of pixels in a horizontal line of the bitmap. | 711 // The number of pixels in a horizontal line of the bitmap. |
528 DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); | 712 DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); |
529 | 713 |
530 // Function: FPDFBitmap_GetHeight | 714 // Function: FPDFBitmap_GetHeight |
531 // Get height of an FXDIB. | 715 // Get height of an FXDIB. |
532 // Parameters: | 716 // Parameters: |
533 //» » » bitmap» » -» Handle to the bitmap. Returned b
y FPDFBitmap_Create function. | 717 //» » » bitmap» » -» Handle to the bitmap. Returned b
y |
| 718 //FPDFBitmap_Create function. |
534 // Return value: | 719 // Return value: |
535 // The number of pixels in a vertical line of the bitmap. | 720 // The number of pixels in a vertical line of the bitmap. |
536 DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); | 721 DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); |
537 | 722 |
538 // Function: FPDFBitmap_GetStride | 723 // Function: FPDFBitmap_GetStride |
539 //» » » Get number of bytes for each scan line in the bitmap buf
fer. | 724 //» » » Get number of bytes for each scan line in the bitmap |
| 725 //buffer. |
540 // Parameters: | 726 // Parameters: |
541 //» » » bitmap» » -» Handle to the bitmap. Returned b
y FPDFBitmap_Create function. | 727 //» » » bitmap» » -» Handle to the bitmap. Returned b
y |
| 728 //FPDFBitmap_Create function. |
542 // Return value: | 729 // Return value: |
543 //» » » The number of bytes for each scan line in the bitmap buf
fer. | 730 //» » » The number of bytes for each scan line in the bitmap |
| 731 //buffer. |
544 // Comments: | 732 // Comments: |
545 //» » » The stride may be more than width * number of bytes per
pixel | 733 //» » » The stride may be more than width * number of bytes per |
| 734 //pixel |
546 DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); | 735 DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); |
547 | 736 |
548 // Function: FPDFBitmap_Destroy | 737 // Function: FPDFBitmap_Destroy |
549 //» » » Destroy an FXDIB and release all related buffers. | 738 //» » » Destroy an FXDIB and release all related buffers. |
550 // Parameters: | 739 // Parameters: |
551 //» » » bitmap» » -» Handle to the bitmap. Returned b
y FPDFBitmap_Create function. | 740 //» » » bitmap» » -» Handle to the bitmap. Returned b
y |
| 741 //FPDFBitmap_Create function. |
552 // Return value: | 742 // Return value: |
553 // None. | 743 // None. |
554 // Comments: | 744 // Comments: |
555 // This function will not destroy any external buffer. | 745 // This function will not destroy any external buffer. |
556 // | 746 // |
557 DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); | 747 DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); |
558 | 748 |
559 // Function: FPDF_VIEWERREF_GetPrintScaling | 749 // Function: FPDF_VIEWERREF_GetPrintScaling |
560 // Whether the PDF document prefers to be scaled or not. | 750 // Whether the PDF document prefers to be scaled or not. |
561 // Parameters: | 751 // Parameters: |
562 // document - Handle to the loaded document. | 752 // document - Handle to the loaded document. |
563 // Return value: | 753 // Return value: |
564 // None. | 754 // None. |
565 // | 755 // |
566 DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT documen
t); | 756 DLLEXPORT FPDF_BOOL STDCALL |
| 757 FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); |
567 | 758 |
568 // Function: FPDF_VIEWERREF_GetNumCopies | 759 // Function: FPDF_VIEWERREF_GetNumCopies |
569 // Returns the number of copies to be printed. | 760 // Returns the number of copies to be printed. |
570 // Parameters: | 761 // Parameters: |
571 // document - Handle to the loaded document. | 762 // document - Handle to the loaded document. |
572 // Return value: | 763 // Return value: |
573 // The number of copies to be printed. | 764 // The number of copies to be printed. |
574 // | 765 // |
575 DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); | 766 DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); |
576 | 767 |
577 // Function: FPDF_VIEWERREF_GetPrintPageRange | 768 // Function: FPDF_VIEWERREF_GetPrintPageRange |
578 //» » » Page numbers to initialize print dialog box when file is
printed. | 769 //» » » Page numbers to initialize print dialog box when file is |
| 770 //printed. |
579 // Parameters: | 771 // Parameters: |
580 // document - Handle to the loaded document. | 772 // document - Handle to the loaded document. |
581 // Return value: | 773 // Return value: |
582 // The print page range to be used for printing. | 774 // The print page range to be used for printing. |
583 // | 775 // |
584 DLLEXPORT FPDF_PAGERANGE STDCALL FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT
document); | 776 DLLEXPORT FPDF_PAGERANGE STDCALL |
| 777 FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); |
585 | 778 |
586 // Function: FPDF_VIEWERREF_GetDuplex | 779 // Function: FPDF_VIEWERREF_GetDuplex |
587 //» » » Returns the paper handling option to be used when printi
ng from print dialog. | 780 //» » » Returns the paper handling option to be used when printi
ng |
| 781 //from print dialog. |
588 // Parameters: | 782 // Parameters: |
589 // document - Handle to the loaded document. | 783 // document - Handle to the loaded document. |
590 // Return value: | 784 // Return value: |
591 // The paper handling option to be used when printing. | 785 // The paper handling option to be used when printing. |
592 // | 786 // |
593 DLLEXPORT FPDF_DUPLEXTYPE STDCALL FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT documen
t); | 787 DLLEXPORT FPDF_DUPLEXTYPE STDCALL |
| 788 FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); |
594 | 789 |
595 // Function: FPDF_GetNamedDestByName | 790 // Function: FPDF_GetNamedDestByName |
596 // get a special dest handle by the index. | 791 // get a special dest handle by the index. |
597 // Parameters: | 792 // Parameters: |
598 // document - Handle to the loaded document. | 793 // document - Handle to the loaded document. |
599 //» » » name» » -» The name of a special named dest
. | 794 //» » » name» » -» The name of a special named |
| 795 //dest. |
600 // Return value: | 796 // Return value: |
601 // The handle of the dest. | 797 // The handle of the dest. |
602 // | 798 // |
603 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_
BYTESTRING name); | 799 DLLEXPORT FPDF_DEST STDCALL |
| 800 FPDF_GetNamedDestByName(FPDF_DOCUMENT document, FPDF_BYTESTRING name); |
604 | 801 |
605 #ifdef __cplusplus | 802 #ifdef __cplusplus |
606 }; | 803 }; |
607 #endif | 804 #endif |
608 | 805 |
609 #endif // _FPDFVIEW_H_ | 806 #endif // _FPDFVIEW_H_ |
OLD | NEW |