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