Foxit Embedded PDF SDK
|
00001 00070 #ifndef _FPDFEMB_H_ 00071 #define _FPDFEMB_H_ 00072 00073 #ifdef __cplusplus 00074 extern "C" { 00075 #endif 00076 00078 typedef int FPDFEMB_RESULT; 00079 00081 typedef int FPDFEMB_BOOL; 00082 00084 typedef unsigned short FPDFEMB_WCHAR; 00085 00090 00092 #define FPDFERR_SUCCESS 0 00093 00094 #define FPDFERR_MEMORY 1 00095 00096 #define FPDFERR_ERROR 2 00097 00098 #define FPDFERR_PASSWORD 3 00099 00100 #define FPDFERR_FORMAT 4 00101 00102 #define FPDFERR_FILE 5 00103 00104 #define FPDFERR_PARAM 6 00105 00106 #define FPDFERR_STATUS 7 00107 00108 #define FPDFERR_TOBECONTINUED 8 00109 00110 #define FPDFERR_NOTFOUND 9 00111 00114 /******************************************************************************************** 00115 **** 00116 **** Library Memory Management 00117 **** 00118 ********************************************************************************************/ 00119 00132 struct FPDFEMB_MEMMGR { 00147 void* (*Alloc)(struct FPDFEMB_MEMMGR* pMgr, unsigned int size); 00148 00161 void* (*AllocNL)(struct FPDFEMB_MEMMGR* pMgr, unsigned int size); 00162 00182 void* (*Realloc)(struct FPDFEMB_MEMMGR* pMgr, void* pointer, unsigned int new_size); 00183 00191 void (*Free)(struct FPDFEMB_MEMMGR* pMgr, void* pointer); 00192 }; 00193 00205 FPDFEMB_RESULT FPDFEMB_Init(struct FPDFEMB_MEMMGR* mem_mgr); 00206 00208 typedef void (*FPDFEMB_FIXED_OOM_HANDLER)(void* memory, int size); 00209 00231 FPDFEMB_RESULT FPDFEMB_InitFixedMemory(void* memory, int size, FPDFEMB_FIXED_OOM_HANDLER oom_handler); 00232 00239 struct FPDFEMB_MEMMGR2 00240 { 00251 FPDFEMB_BOOL (*More)(struct FPDFEMB_MEMMGR2* pMgr, int alloc_size, void** new_memory, int* new_size); 00252 00260 void (*Free)(struct FPDFEMB_MEMMGR2* pMgr, void* memory); 00261 }; 00262 00277 FPDFEMB_RESULT FPDFEMB_InitFixedMemory2(void* memory, int size, struct FPDFEMB_MEMMGR2* callbacks, FPDFEMB_FIXED_OOM_HANDLER oom_handler); 00278 00283 00285 #define FPDFEMB_NONLEAVE 1 00286 00287 #define FPDFEMB_MOVABLE 2 00288 00289 #define FPDFEMB_DISCARDABLE 4 00290 00300 struct FPDFEMB_MEMMGR_EX { 00301 int m_Size; 00318 void* (*Alloc)(struct FPDFEMB_MEMMGR_EX* pMgr, unsigned int size, int flags); 00319 00330 void (*OOM_Handler)(struct FPDFEMB_MEMMGR_EX* pMgr); 00331 00352 void* (*Realloc)(struct FPDFEMB_MEMMGR_EX* pMgr, void* pointer, unsigned int new_size, int flags); 00353 00365 void* (*Lock)(struct FPDFEMB_MEMMGR_EX* pMgr, void* handle); 00366 00378 void (*Unlock)(struct FPDFEMB_MEMMGR_EX* pMgr, void* handle); 00379 00387 void (*Free)(struct FPDFEMB_MEMMGR_EX* pMgr, void* pointer, int flags); 00388 00389 void* user; 00390 }; 00391 00402 FPDFEMB_RESULT FPDFEMB_InitEx(struct FPDFEMB_MEMMGR_EX* mem_mgr); 00403 00415 void FPDFEMB_Exit(); 00416 00429 00431 void FPDFEMB_LoadJbig2Decoder(); 00433 void FPDFEMB_LoadJpeg2000Decoder(); 00434 00444 void* FPDFEMB_AllocMemory(unsigned int size); 00445 00452 void FPDFEMB_FreeMemory(void* pointer); 00453 00462 void FPDFEMB_FreeCaches(); 00463 00464 /******************************************************************************************** 00465 **** 00466 **** Document Operations 00467 **** 00468 ********************************************************************************************/ 00469 00474 struct FPDFEMB_FILE_ACCESS { 00482 unsigned int (*GetSize)(struct FPDFEMB_FILE_ACCESS* file); 00483 00494 FPDFEMB_RESULT (*ReadBlock)(struct FPDFEMB_FILE_ACCESS* file, void* buffer, 00495 unsigned int offset, unsigned int size); 00496 00497 void* user; 00498 }; 00499 00504 struct FPDFEMB_PAUSE { 00517 FPDFEMB_BOOL (*NeedPauseNow)(struct FPDFEMB_PAUSE* pause); 00518 00519 void* user; 00520 }; 00521 00523 typedef void* FPDFEMB_DOCUMENT; 00524 00558 FPDFEMB_RESULT FPDFEMB_StartLoadDocument(struct FPDFEMB_FILE_ACCESS* file, const char* password, 00559 FPDFEMB_DOCUMENT* document, struct FPDFEMB_PAUSE* pause); 00560 00580 FPDFEMB_RESULT FPDFEMB_ContinueLoadDocument(FPDFEMB_DOCUMENT document, struct FPDFEMB_PAUSE* pause); 00581 00589 FPDFEMB_RESULT FPDFEMB_CloseDocument(FPDFEMB_DOCUMENT document); 00590 00598 int FPDFEMB_GetPageCount(FPDFEMB_DOCUMENT document); 00599 00610 void FPDFEMB_SetFileBufferSize(int size); 00611 00612 /******************************************************************************************** 00613 **** 00614 **** Page Basic Operations 00615 **** 00616 ********************************************************************************************/ 00617 00619 typedef void* FPDFEMB_PAGE; 00620 00630 FPDFEMB_RESULT FPDFEMB_LoadPage(FPDFEMB_DOCUMENT document, int index, FPDFEMB_PAGE* page); 00631 00639 FPDFEMB_RESULT FPDFEMB_ClosePage(FPDFEMB_PAGE page); 00640 00650 FPDFEMB_RESULT FPDFEMB_GetPageSize(FPDFEMB_PAGE page, int* width, int* height); 00651 00656 struct FPDFEMB_RECT 00657 { 00664 00666 00672 00674 00677 00687 00719 00741 00751 00760 00788 00806 00812 00814 00816 00818 00858 00879 00890 00908 00920 00928 00930 00933 00964 00980 01002 01019 01033 01035 01037 01039 01062 01082 01094 01105 01114 01131 01140 01164 01181 01187 01193 01195 01200 01216 01232 01244 01246 01248 01250 01252 01279 01293 01302 01311 01323 01332 01344 01363 01391 01401 01412 01414 01416 01418 01420 01422 01424 01432 01434 01436 01438 01440 01442 01444 01446 01448 01450 01458 01478 01483 01496 01504 01521 01544 01590 01597 01615 01632 01648 01654 01656 01658 01660 01666 01695 01704 01710 01712 01714 01716 01718 01720 01728 01730 01732 01734 01736 01738 01740 01742 01744 01746 01751 01754 01755 01769 01773 01776 01777 01780 01783 01786 01789 01790 01810 01827 01840 01849 01862 01875 01901 01917 01928 01949 01960 01971 01988 01998 02004 02006 02008 02010 02012 02014 02016 02018 02020 02022 02024 02026 02028 02030 02032 02044 02058 02067 02073 02075 02077 02093 02105 02108 02127 02144 02153 02167 02190 02202