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