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