Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: public/fpdfview.h

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

Powered by Google App Engine
This is Rietveld 408576698