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