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

Side by Side Diff: public/fpdfview.h

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