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

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 string, each character uses 2
Tom Sepez 2015/10/20 16:29:49 nit: uses ... wide strings (plural)
dsinclair 2015/10/20 16:52:29 Done.
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
66 // Windows unicode string, 66 // Windows unicode string, however, special care needs to be taken if you
Tom Sepez 2015/10/20 16:29:49 nit: as a Windows (add "a").
dsinclair 2015/10/20 16:52:29 Done.
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, you have to convert between FPDF_WIDESTRING and
Tom Sepez 2015/10/20 16:29:49 nit: , and you [or change , to a ; ]
dsinclair 2015/10/20 16:52:28 Done.
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 /** @brief Matrix for transformation. */
Tom Sepez 2015/10/20 16:31:13 Also, can we change these to // - style and drop t
dsinclair 2015/10/20 16:52:28 Done.
81 typedef struct _FS_MATRIX_ { 80 typedef struct _FS_MATRIX_ {
82 float a; /**< @brief Coefficient a.*/ 81 float a; /**< @brief Coefficient a.*/
Tom Sepez 2015/10/20 16:29:49 nit: These comments add no value.
dsinclair 2015/10/20 16:52:28 Done.
83 float b; /**< @brief Coefficient b.*/ 82 float b; /**< @brief Coefficient b.*/
84 float c; /**< @brief Coefficient c.*/ 83 float c; /**< @brief Coefficient c.*/
85 float d; /**< @brief Coefficient d.*/ 84 float d; /**< @brief Coefficient d.*/
86 float e; /**< @brief Coefficient e.*/ 85 float e; /**< @brief Coefficient e.*/
87 float f; /**< @brief Coefficient f.*/ 86 float f; /**< @brief Coefficient f.*/
88 } FS_MATRIX; 87 } FS_MATRIX;
89 88
90 /** @brief Rectangle area(float) in device or page coordination system. */ 89 /** @brief Rectangle area(float) in device or page coordinate system. */
91 typedef struct _FS_RECTF_ { 90 typedef struct _FS_RECTF_ {
92 /**@{*/ 91 /**@{*/
93 /** @brief The x-coordinate of the left-top corner. */ 92 /** @brief The x-coordinate of the left-top corner. */
94 float left; 93 float left;
95 /** @brief The y-coordinate of the left-top corner. */ 94 /** @brief The y-coordinate of the left-top corner. */
96 float top; 95 float top;
97 /** @brief The x-coordinate of the right-bottom corner. */ 96 /** @brief The x-coordinate of the right-bottom corner. */
98 float right; 97 float right;
99 /** @brief The y-coordinate of the right-bottom corner. */ 98 /** @brief The y-coordinate of the right-bottom corner. */
100 float bottom; 99 float bottom;
(...skipping 20 matching lines...) Expand all
121 // Initialize the FPDFSDK library 120 // Initialize the FPDFSDK library
122 // Parameters: 121 // Parameters:
123 // None 122 // None
124 // Return value: 123 // Return value:
125 // None. 124 // None.
126 // Comments: 125 // Comments:
127 // Convenience function to call FPDF_InitLibraryWithConfig() for 126 // Convenience function to call FPDF_InitLibraryWithConfig() for
128 // backwards comatibility purposes. 127 // backwards comatibility purposes.
129 DLLEXPORT void STDCALL FPDF_InitLibrary(); 128 DLLEXPORT void STDCALL FPDF_InitLibrary();
130 129
131 // Process-wide options for initializing library. 130 // Process-wide options for initializing the library.
132 typedef struct FPDF_LIBRARY_CONFIG_ { 131 typedef struct FPDF_LIBRARY_CONFIG_ {
133 // Version number of the interface. Currently must be 2. 132 // Version number of the interface. Currently must be 2.
134 int version; 133 int version;
135 134
136 // Array of paths to scan in place of the defaults when using built-in 135 // 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. 136 // 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 137 // The Array may be NULL itself to use the default paths. May be ignored
139 // entirely depending upon the platform. 138 // entirely depending upon the platform.
140 const char** m_pUserFontPaths; 139 const char** m_pUserFontPaths;
141 140
142 // Version 2. 141 // Version 2.
143 142
144 // pointer to the v8::Isolate to use, or NULL to force PDFium to create one. 143 // pointer to the v8::Isolate to use, or NULL to force PDFium to create one.
145 void* m_pIsolate; 144 void* m_pIsolate;
146 145
147 // The embedder data slot to use in the v8::Isolate to store PDFium's 146 // 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 147 // per-isolate data. The value needs to be between 0 and
149 // v8::Internals::kNumIsolateDataLots (exclusive). Note that 0 is fine 148 // v8::Internals::kNumIsolateDataLots (exclusive). Note that 0 is fine
150 // for most embedders. 149 // for most embedders.
151 unsigned int m_v8EmbedderSlot; 150 unsigned int m_v8EmbedderSlot;
152 } FPDF_LIBRARY_CONFIG; 151 } FPDF_LIBRARY_CONFIG;
153 152
154 // Function: FPDF_InitLibraryWithConfig 153 // Function: FPDF_InitLibraryWithConfig
155 // Initialize the FPDFSDK library 154 // Initialize the FPDFSDK library
156 // Parameters: 155 // Parameters:
157 // cfg - configuration information as above. 156 // config - configuration information as above.
158 // Return value: 157 // Return value:
159 // None. 158 // None.
160 // Comments: 159 // Comments:
161 // You have to call this function before you can call any PDF 160 // You have to call this function before you can call any PDF
162 // processing functions. 161 // processing functions.
163 DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( 162 DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig(
164 const FPDF_LIBRARY_CONFIG* config); 163 const FPDF_LIBRARY_CONFIG* config);
165 164
166 // Function: FPDF_DestroyLibary 165 // Function: FPDF_DestroyLibary
167 // Release all resources allocated by the FPDFSDK library. 166 // Release all resources allocated by the FPDFSDK library.
168 // Parameters: 167 // Parameters:
169 // None. 168 // None.
170 // Return value: 169 // Return value:
171 // None. 170 // None.
172 // Comments: 171 // Comments:
173 // You can call this function to release all memory blocks allocated by 172 // You can call this function to release all memory blocks allocated by
174 // the library. 173 // the library.
175 // After this function called, you should not call any PDF processing 174 // After this function is called, you should not call any PDF
176 // functions. 175 // processing functions.
177 DLLEXPORT void STDCALL FPDF_DestroyLibrary(); 176 DLLEXPORT void STDCALL FPDF_DestroyLibrary();
178 177
179 // Policy for accessing the local machine time. 178 // Policy for accessing the local machine time.
180 #define FPDF_POLICY_MACHINETIME_ACCESS 0 179 #define FPDF_POLICY_MACHINETIME_ACCESS 0
181 180
182 // Function: FPDF_SetSandBoxPolicy 181 // Function: FPDF_SetSandBoxPolicy
183 // Set the policy for the sandbox environment. 182 // Set the policy for the sandbox environment.
184 // Parameters: 183 // Parameters:
185 // policy - The specified policy for setting, for 184 // policy - The specified policy for setting, for example:
186 // example:FPDF_POLICY_MACHINETIME_ACCESS. 185 // FPDF_POLICY_MACHINETIME_ACCESS.
187 // enable - True for enable, False for disable the policy. 186 // enable - True to enable, False to disable the policy.
Tom Sepez 2015/10/20 16:29:49 nit: no need to capitalize False.
dsinclair 2015/10/20 16:52:28 Done.
188 // Return value: 187 // Return value:
189 // None. 188 // None.
190 DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, 189 DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy,
191 FPDF_BOOL enable); 190 FPDF_BOOL enable);
192 191
193 // Function: FPDF_LoadDocument 192 // Function: FPDF_LoadDocument
194 // Open and load a PDF document. 193 // Open and load a PDF document.
195 // Parameters: 194 // Parameters:
196 // file_path [in] - Path to the PDF file (including extension). 195 // file_path - Path to the PDF file (including extension).
197 // password [in] - A string used as the password for PDF file. 196 // password - A string used as the password for the PDF file.
198 // If no password needed, empty or NULL can be used. 197 // If no password is needed, empty or NULL can be used.
199 // Return value: 198 // Return value:
200 // A handle to the loaded document, or NULL on failure. 199 // A handle to the loaded document, or NULL on failure.
201 // Comments: 200 // Comments:
202 // Loaded document can be closed by FPDF_CloseDocument(). 201 // Loaded document can be closed by FPDF_CloseDocument().
203 // If this function fails, you can use FPDF_GetLastError() to retrieve 202 // If this function fails, you can use FPDF_GetLastError() to retrieve
204 // the reason why it failed. 203 // the reason why it failed.
205 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, 204 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path,
206 FPDF_BYTESTRING password); 205 FPDF_BYTESTRING password);
207 206
208 // Function: FPDF_LoadMemDocument 207 // Function: FPDF_LoadMemDocument
209 // Open and load a PDF document from memory. 208 // Open and load a PDF document from memory.
210 // Parameters: 209 // Parameters:
211 // data_buf - Pointer to a buffer containing the PDF document. 210 // data_buf - Pointer to a buffer containing the PDF document.
212 // size - Number of bytes in the PDF document. 211 // size - Number of bytes in the PDF document.
213 // password - A string used as the password for PDF file. 212 // password - A string used as the password for the PDF file.
214 // If no password needed, empty or NULL can be used. 213 // If no password is needed, empty or NULL can be used.
215 // Return value: 214 // Return value:
216 // A handle to the loaded document. If failed, NULL is returned. 215 // A handle to the loaded document, or NULL on failure.
217 // Comments: 216 // Comments:
218 // The memory buffer must remain valid when the document is open. 217 // The memory buffer must remain valid when the document is open.
219 // Loaded document can be closed by FPDF_CloseDocument. 218 // The loaded document can be closed by FPDF_CloseDocument.
220 // If this function fails, you can use FPDF_GetLastError() to retrieve 219 // If this function fails, you can use FPDF_GetLastError() to retrieve
221 // the reason why it fails. 220 // the reason why it failed.
222 //
223 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, 221 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf,
224 int size, 222 int size,
225 FPDF_BYTESTRING password); 223 FPDF_BYTESTRING password);
226 224
227 // Structure for custom file access. 225 // Structure for custom file access.
228 typedef struct { 226 typedef struct {
229 // File length, in bytes. 227 // File length, in bytes.
230 unsigned long m_FileLen; 228 unsigned long m_FileLen;
231 229
232 // A function pointer for getting a block of data from specific position. 230 // 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. 231 // 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. 232 // 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 233 // It may be possible for FPDFSDK to call this function multiple times for
236 // same position. 234 // the same position.
237 // Return value: should be non-zero if successful, zero for error. 235 // Return value: should be non-zero if successful, zero for error.
238 int (*m_GetBlock)(void* param, 236 int (*m_GetBlock)(void* param,
239 unsigned long position, 237 unsigned long position,
240 unsigned char* pBuf, 238 unsigned char* pBuf,
241 unsigned long size); 239 unsigned long size);
242 240
243 // A custom pointer for all implementation specific data. 241 // 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. 242 // be used as the first parameter to the m_GetBlock callback.
245 void* m_Param; 243 void* m_Param;
246 } FPDF_FILEACCESS; 244 } FPDF_FILEACCESS;
247 245
248 // Function: FPDF_LoadCustomDocument 246 // Function: FPDF_LoadCustomDocument
249 // Load PDF document from a custom access descriptor. 247 // Load PDF document from a custom access descriptor.
250 // Parameters: 248 // Parameters:
251 // pFileAccess - A structure for access the file. 249 // pFileAccess - A structure for accessing the file.
252 // password - Optional password for decrypting the PDF file. 250 // password - Optional password for decrypting the PDF file.
253 // Return value: 251 // Return value:
254 // A handle to the loaded document. If failed, NULL is returned. 252 // A handle to the loaded document, or NULL on failure.
255 // Comments: 253 // Comments:
256 // The application should maintain the file resources being valid until 254 // The application should maintain the file resources until
Tom Sepez 2015/10/20 16:29:49 nit: The application must keep the file resources
dsinclair 2015/10/20 16:52:28 Done.
257 // the PDF document close. 255 // the PDF document close.
258 // Loaded document can be closed by FPDF_CloseDocument. 256 // Loaded document can be closed by 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 this call succeeds.
Tom Sepez 2015/10/20 16:29:49 nit: succeeds, false otherwise.
dsinclair 2015/10/20 16:52:28 Done.
270 // Comments: 268 // Comments:
271 // If the document is created by function ::FPDF_CreateNewDocument, 269 // If the document is created by ::FPDF_CreateNewDocument,
Tom Sepez 2015/10/20 16:29:49 nit: lose the ::, "was created by"
dsinclair 2015/10/20 16:52:28 Done.
272 // then this function would always fail. 270 // then this function would always fail.
Tom Sepez 2015/10/20 16:29:49 nit: will always
dsinclair 2015/10/20 16:52:28 Done.
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 #define FPDF_ANNOT 0x01 // Set if annotations are to be rendered.
Tom Sepez 2015/10/20 16:29:49 nit: (super-nit) can we get these each to fit on a
dsinclair 2015/10/20 16:52:28 Done.
391 #define FPDF_LCD_TEXT \ 370 #define FPDF_LCD_TEXT \
392 0x02 // Set if using text rendering optimized for LCD display. 371 0x02 // Set if using text rendering optimized for LCD display.
393 #define FPDF_NO_NATIVETEXT \ 372 #define FPDF_NO_NATIVETEXT \
394 0x04 // Don't use the native text output available on some platforms 373 0x04 // Don't use the native text output available on some platforms
395 #define FPDF_GRAYSCALE 0x08 // Grayscale output. 374 #define FPDF_GRAYSCALE 0x08 // Grayscale output.
396 #define FPDF_DEBUG_INFO 0x80 // Set if you want to get some debug info. 375 #define FPDF_DEBUG_INFO 0x80 // Set if you want to get some debug info.
397 // Please discuss with Foxit first if you need to collect debug info. 376 #define FPDF_NO_CATCH 0x100 // Set if you don't want to catch exceptions.
398 #define FPDF_NO_CATCH 0x100 // Set if you don't want to catch exception.
399 #define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 // Limit image cache size. 377 #define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 // Limit image cache size.
400 #define FPDF_RENDER_FORCEHALFTONE \ 378 #define FPDF_RENDER_FORCEHALFTONE \
401 0x400 // Always use halftone for image stretching. 379 0x400 // Always use halftone for image stretching.
402 #define FPDF_PRINTING 0x800 // Render for printing. 380 #define FPDF_PRINTING 0x800 // Render for printing.
403 #define FPDF_RENDER_NO_SMOOTHTEXT \ 381 #define FPDF_RENDER_NO_SMOOTHTEXT \
404 0x1000 // Set to disable anti-aliasing on text. 382 0x1000 // Set to disable anti-aliasing on text.
405 #define FPDF_RENDER_NO_SMOOTHIMAGE \ 383 #define FPDF_RENDER_NO_SMOOTHIMAGE \
406 0x2000 // Set to disable anti-aliasing on images. 384 0x2000 // Set to disable anti-aliasing on images.
407 #define FPDF_RENDER_NO_SMOOTHPATH \ 385 #define FPDF_RENDER_NO_SMOOTHPATH \
408 0x4000 // Set to disable anti-aliasing on paths. 386 0x4000 // Set to disable anti-aliasing on paths.
409 #define FPDF_REVERSE_BYTE_ORDER \ 387 #define FPDF_REVERSE_BYTE_ORDER \
410 0x10 // set whether render in a reverse Byte order, this flag only 388 0x10 // set whether to render in a reverse Byte order, this flag is only
411 // enable when render to a bitmap. 389 // used when rendering to a bitmap.
390
412 #ifdef _WIN32 391 #ifdef _WIN32
413 // Function: FPDF_RenderPage 392 // Function: FPDF_RenderPage
414 // Render contents in a page to a device (screen, bitmap, or printer). 393 // Render contents of a page to a device (screen, bitmap, or printer).
415 // This function is only supported on Windows system. 394 // This function is only supported on Windows.
416 // Parameters: 395 // Parameters:
417 // dc - Handle to device context. 396 // dc - Handle to the device context.
418 // page - Handle to the page. Returned by FPDF_LoadPage 397 // page - Handle to the page. Returned by FPDF_LoadPage.
419 // function. 398 // start_x - Left pixel position of the display area in
420 // start_x - Left pixel position of the display area in the 399 // device coordinates.
421 // device coordinate. 400 // start_y - Top pixel position of the display area in device
422 // start_y - Top pixel position of the display area in the device 401 // coordinates.
423 // coordinate.
424 // size_x - Horizontal size (in pixels) for displaying the page. 402 // size_x - Horizontal size (in pixels) for displaying the page.
425 // size_y - Vertical size (in pixels) for displaying the page. 403 // size_y - Vertical size (in pixels) for displaying the page.
426 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees 404 // rotate - Page orientation:
427 // clockwise), 405 // 0 (normal)
428 // 2 (rotated 180 degrees), 3 (rotated 90 degrees 406 // 1 (rotated 90 degrees clockwise)
429 // counter-clockwise). 407 // 2 (rotated 180 degrees)
408 // 3 (rotated 90 degrees counter-clockwise)
430 // flags - 0 for normal display, or combination of flags 409 // flags - 0 for normal display, or combination of flags
431 // defined above. 410 // defined above.
432 // Return value: 411 // Return value:
433 // None. 412 // None.
434 //
435 DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, 413 DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
436 FPDF_PAGE page, 414 FPDF_PAGE page,
437 int start_x, 415 int start_x,
438 int start_y, 416 int start_y,
439 int size_x, 417 int size_x,
440 int size_y, 418 int size_y,
441 int rotate, 419 int rotate,
442 int flags); 420 int flags);
443 #endif 421 #endif
444 422
445 // Function: FPDF_RenderPageBitmap 423 // Function: FPDF_RenderPageBitmap
446 // Render contents in a page to a device independent bitmap 424 // Render contents of a page to a device independent bitmap.
447 // Parameters: 425 // Parameters:
448 // bitmap - Handle to the device independent bitmap (as the 426 // bitmap - Handle to the device independent bitmap (as the
449 // output buffer). 427 // output buffer). The bitmap handle can be created
450 // Bitmap handle can be created by FPDFBitmap_Create 428 // by FPDFBitmap_Create.
451 // function.
452 // page - Handle to the page. Returned by FPDF_LoadPage 429 // page - Handle to the page. Returned by FPDF_LoadPage
453 // function. 430 // start_x - Left pixel position of the display area in
454 // start_x - Left pixel position of the display area in the 431 // bitmap coordinates.
455 // bitmap coordinate. 432 // start_y - Top pixel position of the display area in bitmap
456 // start_y - Top pixel position of the display area in the bitmap 433 // coordinates.
457 // coordinate.
458 // size_x - Horizontal size (in pixels) for displaying the page. 434 // size_x - Horizontal size (in pixels) for displaying the page.
459 // size_y - Vertical size (in pixels) for displaying the page. 435 // size_y - Vertical size (in pixels) for displaying the page.
460 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees 436 // rotate - Page orientation:
461 // clockwise), 437 // 0 (normal)
462 // 2 (rotated 180 degrees), 3 (rotated 90 degrees 438 // 1 (rotated 90 degrees clockwise)
463 // counter-clockwise). 439 // 2 (rotated 180 degrees)
440 // 3 (rotated 90 degrees counter-clockwise)
464 // flags - 0 for normal display, or combination of flags 441 // flags - 0 for normal display, or combination of flags
465 // defined above. 442 // defined above.
466 // Return value: 443 // Return value:
467 // None. 444 // None.
468 //
469 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, 445 DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
470 FPDF_PAGE page, 446 FPDF_PAGE page,
471 int start_x, 447 int start_x,
472 int start_y, 448 int start_y,
473 int size_x, 449 int size_x,
474 int size_y, 450 int size_y,
475 int rotate, 451 int rotate,
476 int flags); 452 int flags);
477 453
478 // Function: FPDF_ClosePage 454 // Function: FPDF_ClosePage
479 // Close a loaded PDF page. 455 // Close a loaded PDF page.
480 // Parameters: 456 // Parameters:
481 // page - Handle to the loaded page. 457 // page - Handle to the loaded page.
482 // Return value: 458 // Return value:
483 // None. 459 // None.
484 //
485 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); 460 DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);
486 461
487 // Function: FPDF_CloseDocument 462 // Function: FPDF_CloseDocument
488 // Close a loaded PDF document. 463 // Close a loaded PDF document.
489 // Parameters: 464 // Parameters:
490 // document - Handle to the loaded document. 465 // document - Handle to the loaded document.
491 // Return value: 466 // Return value:
492 // None. 467 // None.
493 //
494 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); 468 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
495 469
496 // Function: FPDF_DeviceToPage 470 // Function: FPDF_DeviceToPage
497 // Convert the screen coordinate of a point to page coordinate. 471 // Convert the screen coordinates of a point to page coordinates.
498 // Parameters: 472 // Parameters:
499 // page - Handle to the page. Returned by FPDF_LoadPage 473 // page - Handle to the page. Returned by FPDF_LoadPage.
500 // function. 474 // start_x - Left pixel position of the display area in
501 // start_x - Left pixel position of the display area in the 475 // device coordinates.
502 // device coordinate. 476 // start_y - Top pixel position of the display area in device
503 // start_y - Top pixel position of the display area in the device 477 // coordinates.
504 // coordinate.
505 // size_x - Horizontal size (in pixels) for displaying the page. 478 // size_x - Horizontal size (in pixels) for displaying the page.
506 // size_y - Vertical size (in pixels) for displaying the page. 479 // size_y - Vertical size (in pixels) for displaying the page.
507 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees 480 // rotate - Page orientation:
508 // clockwise), 481 // 0 (normal)
509 // 2 (rotated 180 degrees), 3 (rotated 90 degrees 482 // 1 (rotated 90 degrees clockwise)
510 // counter-clockwise). 483 // 2 (rotated 180 degrees)
511 // device_x - X value in device coordinate, for the point to be 484 // 3 (rotated 90 degrees counter-clockwise)
512 // converted. 485 // device_x - X value in device coordinates to be converted.
513 // device_y - Y value in device coordinate, for the point to be 486 // device_y - Y value in device coordinates to be converted.
514 // converted. 487 // page_x - A pointer to a double receiving the converted X
515 // page_x - A Pointer to a double receiving the converted X 488 // value in page coordinates.
516 // value in page coordinate. 489 // page_y - A pointer to a double receiving the converted Y
517 // page_y - A Pointer to a double receiving the converted Y 490 // value in page coordinates.
518 // value in page coordinate.
519 // Return value: 491 // Return value:
520 // None. 492 // None.
521 // Comments: 493 // Comments:
522 // The page coordinate system has its origin at left-bottom corner of 494 // The page coordinate system has its origin at the left-bottom corner
523 // the page, with X axis goes along 495 // 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 496 // the Y-axis on the left side going up.
525 // upward. NOTE: this coordinate system 497 //
526 // can be altered when you zoom, scroll, or rotate a page, however, a 498 // NOTE: this coordinate system can be altered when you zoom, scroll,
527 // point on the page should always have 499 // or rotate a page, however, a point on the page should always have
528 // the same coordinate values in the page coordinate system. 500 // the same coordinate values in the page coordinate system.
529 // 501 //
530 // The device coordinate system is device dependent. For screen device, 502 // The device coordinate system is device dependent. For screen device,
531 // its origin is at left-top 503 // 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 504 // origin can be altered by the Windows coordinate transformation
533 // coordinate transformation 505 // 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 // 506 //
507 // You must make sure the start_x, start_y, size_x, size_y
508 // and rotate parameters have exactly same values as you used in
509 // the FPDF_RenderPage() function call.
538 DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, 510 DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page,
539 int start_x, 511 int start_x,
540 int start_y, 512 int start_y,
541 int size_x, 513 int size_x,
542 int size_y, 514 int size_y,
543 int rotate, 515 int rotate,
544 int device_x, 516 int device_x,
545 int device_y, 517 int device_y,
546 double* page_x, 518 double* page_x,
547 double* page_y); 519 double* page_y);
548 520
549 // Function: FPDF_PageToDevice 521 // Function: FPDF_PageToDevice
550 // Convert the page coordinate of a point to screen coordinate. 522 // Convert the page coordinates of a point to screen coordinates.
551 // Parameters: 523 // Parameters:
552 // page - Handle to the page. Returned by FPDF_LoadPage 524 // page - Handle to the page. Returned by FPDF_LoadPage.
553 // function. 525 // start_x - Left pixel position of the display area in
554 // start_x - Left pixel position of the display area in the 526 // device coordinates.
555 // device coordinate. 527 // start_y - Top pixel position of the display area in device
556 // start_y - Top pixel position of the display area in the device 528 // coordinates.
557 // coordinate.
558 // size_x - Horizontal size (in pixels) for displaying the page. 529 // size_x - Horizontal size (in pixels) for displaying the page.
559 // size_y - Vertical size (in pixels) for displaying the page. 530 // size_y - Vertical size (in pixels) for displaying the page.
560 // rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees 531 // rotate - Page orientation:
561 // clockwise), 532 // 0 (normal)
562 // 2 (rotated 180 degrees), 3 (rotated 90 degrees 533 // 1 (rotated 90 degrees clockwise)
563 // counter-clockwise). 534 // 2 (rotated 180 degrees)
564 // page_x - X value in page coordinate, for the point to be 535 // 3 (rotated 90 degrees counter-clockwise)
565 // converted. 536 // page_x - X value in page coordinates.
566 // page_y - Y value in page coordinate, for the point to be 537 // page_y - Y value in page coordinate.
567 // converted. 538 // device_x - A pointer to an integer receiving the result X
568 // device_x - A pointer to an integer receiving the result X value 539 // value in device coordinates.
569 // in device coordinate. 540 // device_y - A pointer to an integer receiving the result Y
570 // device_y - A pointer to an integer receiving the result Y value 541 // value in device coordinates.
571 // in device coordinate.
572 // Return value: 542 // Return value:
573 // None. 543 // None.
574 // Comments: 544 // Comments:
575 // See comments of FPDF_DeviceToPage() function. 545 // See comments for FPDF_DeviceToPage().
576 //
577 DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, 546 DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
578 int start_x, 547 int start_x,
579 int start_y, 548 int start_y,
580 int size_x, 549 int size_x,
581 int size_y, 550 int size_y,
582 int rotate, 551 int rotate,
583 double page_x, 552 double page_x,
584 double page_y, 553 double page_y,
585 int* device_x, 554 int* device_x,
586 int* device_y); 555 int* device_y);
587 556
588 // Function: FPDFBitmap_Create 557 // Function: FPDFBitmap_Create
589 // Create a Foxit Device Independent Bitmap (FXDIB). 558 // Create a device independent bitmap (FXDIB).
590 // Parameters: 559 // Parameters:
591 // width - Number of pixels in a horizontal line of the bitmap. 560 // width - The number of pixels in width for the bitmap.
592 // Must be greater than 0. 561 // Must be greater than 0.
593 // height - Number of pixels in a vertical line of the bitmap. 562 // height - The number of pixels in height for the bitmap.
594 // Must be greater than 0. 563 // Must be greater than 0.
595 // alpha - A flag indicating whether alpha channel is used. 564 // alpha - A flag indicating whether the alpha channel is used.
596 // Non-zero for using alpha, zero for not using. 565 // Non-zero for using alpha, zero for not using.
597 // Return value: 566 // Return value:
598 // The created bitmap handle, or NULL if parameter error or out of 567 // The created bitmap handle, or NULL if a parameter error or out of
599 // memory. 568 // memory.
600 // Comments: 569 // Comments:
601 // An FXDIB always use 4 byte per pixel. The first byte of a pixel is 570 // The bitmap always uses 4 bytes per pixel. The first byte is always
602 // always double word aligned. 571 // double word aligned.
603 // Each pixel contains red (R), green (G), blue (B) and optionally 572 //
604 // alpha (A) values.
605 // The byte order is BGRx (the last byte unused if no alpha channel) or 573 // The byte order is BGRx (the last byte unused if no alpha channel) or
606 // BGRA. 574 // BGRA.
607 // 575 //
608 // The pixels in a horizontal line (also called scan line) are stored 576 // The pixels in a horizontal line are stored side by side, with the
609 // side by side, with left most 577 // left most pixel stored first (with lower memory address).
610 // pixel stored first (with lower memory address). Each scan line uses 578 // Each line uses width * 4 bytes.
611 // width*4 bytes.
612 // 579 //
613 // Scan lines are stored one after another, with top most scan line 580 // Lines are stored one after another, with the top most line stored
614 // stored first. There is no gap 581 // first. There is no gap between adjacent lines.
615 // between adjacent scan lines.
616 // 582 //
617 // This function allocates enough memory for holding all pixels in the 583 // This function allocates enough memory for holding all pixels in the
618 // bitmap, but it doesn't 584 // bitmap, but it doesn't initialize the buffer. Applications can use
619 // initialize the buffer. Applications can use FPDFBitmap_FillRect to 585 // 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, 586 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width,
622 int height, 587 int height,
623 int alpha); 588 int alpha);
624 589
625 // More DIB formats 590 // More DIB formats
626 #define FPDFBitmap_Gray 1 // Gray scale bitmap, one byte per pixel. 591 #define FPDFBitmap_Gray 1 // Gray scale bitmap, one byte per pixel.
627 #define FPDFBitmap_BGR 2 // 3 bytes per pixel, byte order: blue, green, red. 592 #define FPDFBitmap_BGR 2 // 3 bytes per pixel, byte order: blue, green, red.
628 #define FPDFBitmap_BGRx \ 593 #define FPDFBitmap_BGRx \
629 3 // 4 bytes per pixel, byte order: blue, green, red, unused. 594 3 // 4 bytes per pixel, byte order: blue, green, red, unused.
630 #define FPDFBitmap_BGRA \ 595 #define FPDFBitmap_BGRA \
631 4 // 4 bytes per pixel, byte order: blue, green, red, alpha. 596 4 // 4 bytes per pixel, byte order: blue, green, red, alpha.
632 597
633 // Function: FPDFBitmap_CreateEx 598 // Function: FPDFBitmap_CreateEx
634 // Create a Foxit Device Independent Bitmap (FXDIB) 599 // Create a device independent bitmap (FXDIB)
635 // Parameters: 600 // Parameters:
636 // width - Number of pixels in a horizontal line of the bitmap. 601 // width - The number of pixels in width for the bitmap.
637 // Must be greater than 0. 602 // Must be greater than 0.
638 // height - Number of pixels in a vertical line of the bitmap. 603 // height - The number of pixels in height for the bitmap.
639 // Must be greater than 0. 604 // Must be greater than 0.
640 // format - A number indicating for bitmap format, as defined 605 // format - A number indicating for bitmap format, as defined
641 // above. 606 // above.
642 // first_scan - A pointer to the first byte of first scan line, for 607 // first_scan - A pointer to the first byte of the first line if
643 // external buffer 608 // using an external buffer. If this parameter is NULL,
644 // only. If this parameter is NULL, then the SDK will 609 // then the a new buffer will be created.
645 // create its own buffer.
646 // stride - Number of bytes for each scan line, for external 610 // stride - Number of bytes for each scan line, for external
647 // buffer only.. 611 // buffer only.
648 // Return value: 612 // Return value:
649 // The created bitmap handle, or NULL if parameter error or out of 613 // The bitmap handle, or NULL if parameter error or out of memory.
650 // memory.
651 // Comments: 614 // Comments:
652 // Similar to FPDFBitmap_Create function, with more formats and 615 // Similar to FPDFBitmap_Create function, bug allows for more formats
Tom Sepez 2015/10/20 16:29:49 but allows [ :). ]
dsinclair 2015/10/20 16:52:28 Done.
653 // external buffer supported. 616 // 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 617 // function can be used in any place that a FPDF_BITMAP handle is
655 // FPDF_BITMAP handle is
656 // required. 618 // required.
657 // 619 //
658 // If external scanline buffer is used, then the application should 620 // If an external buffer is used, then the application should destroy
659 // destroy the buffer 621 // the buffer by itself. FPDFBitmap_Destroy function will not destroy
660 // by itself. FPDFBitmap_Destroy function will not destroy the buffer. 622 // the buffer.
661 //
662 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, 623 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width,
663 int height, 624 int height,
664 int format, 625 int format,
665 void* first_scan, 626 void* first_scan,
666 int stride); 627 int stride);
667 628
668 // Function: FPDFBitmap_FillRect 629 // Function: FPDFBitmap_FillRect
669 // Fill a rectangle area in an FXDIB. 630 // Fill a rectangle in a bitmap.
670 // Parameters: 631 // Parameters:
671 // bitmap - The handle to the bitmap. Returned by 632 // bitmap - The handle to the bitmap. Returned by
672 // FPDFBitmap_Create function. 633 // FPDFBitmap_Create.
673 // left - The left side position. Starting from 0 at the 634 // left - The left position. Starting from 0 at the
674 // left-most pixel. 635 // left-most pixel.
675 // top - The top side position. Starting from 0 at the 636 // top - The top position. Starting from 0 at the
676 // top-most scan line. 637 // top-most line.
677 // width - Number of pixels to be filled in each scan line. 638 // width - Width in pixels to be filled.
678 // height - Number of scan lines to be filled. 639 // height - Height in pixels to be filled.
679 // color - A 32-bit value specifing the color, in 8888 ARGB 640 // color - A 32-bit value specifing the color, in 8888 ARGB
680 // format. 641 // format.
681 // Return value: 642 // Return value:
682 // None. 643 // None.
683 // Comments: 644 // Comments:
684 // This function set the color and (optionally) alpha value in 645 // This function sets the color and (optionally) alpha value in the
685 // specified region of the bitmap. 646 // 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 // 647 //
648 // NOTE: If the alpha channel is used, this function does NOT
649 // composite the background with the source color, instead the
650 // background will be replaced by the source color and the alpha.
651 //
652 // If the alpha channel is not used, the alpha parameter is ignored.
692 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, 653 DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
693 int left, 654 int left,
694 int top, 655 int top,
695 int width, 656 int width,
696 int height, 657 int height,
697 FPDF_DWORD color); 658 FPDF_DWORD color);
698 659
699 // Function: FPDFBitmap_GetBuffer 660 // Function: FPDFBitmap_GetBuffer
700 // Get data buffer of an FXDIB 661 // Get data buffer of a bitmap.
701 // Parameters: 662 // Parameters:
702 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 663 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create.
703 // function.
704 // Return value: 664 // Return value:
705 // The pointer to the first byte of the bitmap buffer. 665 // The pointer to the first byte of the bitmap buffer.
706 // Comments: 666 // Comments:
707 // The stride may be more than width * number of bytes per pixel 667 // The stride may be more than width * number of bytes per pixel
668 //
708 // Applications can use this function to get the bitmap buffer pointer, 669 // Applications can use this function to get the bitmap buffer pointer,
709 // then manipulate any color 670 // then manipulate any color and/or alpha values for any pixels in the
710 // and/or alpha values for any pixels in the bitmap. 671 // bitmap.
672 //
673 // The data is in BGRA format. Where the A maybe unused if alpha was
674 // not specified.
711 DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); 675 DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
712 676
713 // Function: FPDFBitmap_GetWidth 677 // Function: FPDFBitmap_GetWidth
714 // Get width of an FXDIB. 678 // Get width of a bitmap.
715 // Parameters: 679 // Parameters:
716 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 680 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create.
717 // function.
718 // Return value: 681 // Return value:
719 // The number of pixels in a horizontal line of the bitmap. 682 // The width of the bitmap in pixels.
720 DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); 683 DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);
721 684
722 // Function: FPDFBitmap_GetHeight 685 // Function: FPDFBitmap_GetHeight
723 // Get height of an FXDIB. 686 // Get height of a bitmap.
724 // Parameters: 687 // Parameters:
725 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 688 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create.
726 // function.
727 // Return value: 689 // Return value:
728 // The number of pixels in a vertical line of the bitmap. 690 // The height of the bitmap in pixels.
729 DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); 691 DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);
730 692
731 // Function: FPDFBitmap_GetStride 693 // Function: FPDFBitmap_GetStride
732 // Get number of bytes for each scan line in the bitmap buffer. 694 // Get number of bytes for each line in the bitmap buffer.
733 // Parameters: 695 // Parameters:
734 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 696 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create.
735 // function.
736 // Return value: 697 // Return value:
737 // The number of bytes for each scan line in the bitmap buffer. 698 // The number of bytes for each line in the bitmap buffer.
738 // Comments: 699 // Comments:
739 // The stride may be more than width * number of bytes per pixel 700 // The stride may be more than width * number of bytes per pixel.
740 DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); 701 DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap);
741 702
742 // Function: FPDFBitmap_Destroy 703 // Function: FPDFBitmap_Destroy
743 // Destroy an FXDIB and release all related buffers. 704 // Destroy a bitmap and release all related buffers.
744 // Parameters: 705 // Parameters:
745 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create 706 // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create.
746 // function.
747 // Return value: 707 // Return value:
748 // None. 708 // None.
749 // Comments: 709 // Comments:
750 // This function will not destroy any external buffer. 710 // This function will not destroy any external buffers provided when
751 // 711 // the bitmap was created.
752 DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); 712 DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap);
753 713
754 // Function: FPDF_VIEWERREF_GetPrintScaling 714 // Function: FPDF_VIEWERREF_GetPrintScaling
755 // Whether the PDF document prefers to be scaled or not. 715 // Whether the PDF document prefers to be scaled or not.
756 // Parameters: 716 // Parameters:
757 // document - Handle to the loaded document. 717 // document - Handle to the loaded document.
758 // Return value: 718 // Return value:
759 // None. 719 // None.
760 //
761 DLLEXPORT FPDF_BOOL STDCALL 720 DLLEXPORT FPDF_BOOL STDCALL
762 FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); 721 FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
763 722
764 // Function: FPDF_VIEWERREF_GetNumCopies 723 // Function: FPDF_VIEWERREF_GetNumCopies
765 // Returns the number of copies to be printed. 724 // Returns the number of copies to be printed.
766 // Parameters: 725 // Parameters:
767 // document - Handle to the loaded document. 726 // document - Handle to the loaded document.
768 // Return value: 727 // Return value:
769 // The number of copies to be printed. 728 // The number of copies to be printed.
770 //
771 DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); 729 DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document);
772 730
773 // Function: FPDF_VIEWERREF_GetPrintPageRange 731 // Function: FPDF_VIEWERREF_GetPrintPageRange
774 // Page numbers to initialize print dialog box when file is printed. 732 // Page numbers to initialize print dialog box when file is printed.
775 // Parameters: 733 // Parameters:
776 // document - Handle to the loaded document. 734 // document - Handle to the loaded document.
777 // Return value: 735 // Return value:
778 // The print page range to be used for printing. 736 // The print page range to be used for printing.
779 //
780 DLLEXPORT FPDF_PAGERANGE STDCALL 737 DLLEXPORT FPDF_PAGERANGE STDCALL
781 FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); 738 FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document);
782 739
783 // Function: FPDF_VIEWERREF_GetDuplex 740 // Function: FPDF_VIEWERREF_GetDuplex
784 // Returns the paper handling option to be used when printing from 741 // Returns the paper handling option to be used when printing from
785 // print dialog. 742 // the print dialog.
786 // Parameters: 743 // Parameters:
787 // document - Handle to the loaded document. 744 // document - Handle to the loaded document.
788 // Return value: 745 // Return value:
789 // The paper handling option to be used when printing. 746 // The paper handling option to be used when printing.
790 //
791 DLLEXPORT FPDF_DUPLEXTYPE STDCALL 747 DLLEXPORT FPDF_DUPLEXTYPE STDCALL
792 FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); 748 FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
793 749
794 // Function: FPDF_CountNamedDests 750 // Function: FPDF_CountNamedDests
795 // Get the count of named destinations in the PDF document. 751 // Get the count of named destinations in the PDF document.
796 // Parameters: 752 // Parameters:
797 // document - Handle to a document 753 // document - Handle to a document
798 // Return value: 754 // Return value:
799 // The count of named destinations. 755 // The count of named destinations.
800 DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document); 756 DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document);
801 757
802 // Function: FPDF_GetNamedDestByName 758 // Function: FPDF_GetNamedDestByName
803 // get a special dest handle by the index. 759 // Get a the destination handle for the given name.
804 // Parameters: 760 // Parameters:
805 // document - Handle to the loaded document. 761 // document - Handle to the loaded document.
806 // name - The name of a special named dest. 762 // name - The name of a destination.
807 // Return value: 763 // Return value:
808 // The handle of the dest. 764 // The handle to the destination.
809 //
810 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, 765 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,
811 FPDF_BYTESTRING name); 766 FPDF_BYTESTRING name);
812 767
813 // Function: FPDF_GetNamedDest 768 // Function: FPDF_GetNamedDest
814 // Get the specified named destinations of the PDF document by index. 769 // Get the named destination by index.
815 // Parameters: 770 // Parameters:
816 // document - Handle to a document 771 // document - Handle to a document
817 // index - The index of named destination. 772 // index - The index of a named destination.
818 // buffer - The buffer to obtain destination name, used as 773 // buffer - The buffer to store the destination name,
819 // wchar_t*. 774 // used as wchar_t*.
820 // buflen [in/out] - Size of the buffer in bytes on input, length of 775 // 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. 776 // length of the result in bytes on output
777 // or -1 if the buffer is too small.
822 // Return value: 778 // Return value:
823 // The destination handle of a named destination, or NULL if no named 779 // The destination handle for a given index, or NULL if there is no
824 // destination corresponding to |index|. 780 // named destination corresponding to |index|.
825 // Comments: 781 // Comments:
826 // Call this function twice to get the name of the named destination: 782 // Call this function twice to get the name of the named destination:
827 // 1) First time pass in |buffer| as NULL and get buflen. 783 // 1) First time pass in |buffer| as NULL and get buflen.
828 // 2) Second time pass in allocated |buffer| and buflen to retrieve 784 // 2) Second time pass in allocated |buffer| and buflen to retrieve
829 // |buffer|, which should be used as wchar_t*. 785 // |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 // 786 //
787 // If buflen is not sufficiently large, it will be set to -1 upon
788 // return.
833 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, 789 DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document,
834 int index, 790 int index,
835 void* buffer, 791 void* buffer,
836 long* buflen); 792 long* buflen);
837 793
838 #ifdef __cplusplus 794 #ifdef __cplusplus
839 } 795 }
840 #endif 796 #endif
841 797
842 #endif // PUBLIC_FPDFVIEW_H_ 798 #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