Foxit Embedded PDF SDK
Data Structures | Typedefs | Functions

D:/svn/doxy/sources/fpdfemb.h File Reference

Header file for FPDFEMB SDK. More...

Go to the source code of this file.

Data Structures

struct  FPDFEMB_MEMMGR
 Structure: FPDFEMB_MEMMGR Including interfaces implemented by host application, providing memory allocation facilities. All members are required. A memory manager structure is required to be valid during the entire period when an application using FPDFEMB module. More...
struct  FPDFEMB_MEMMGR2
 Structure: FPDFEMB_MEMMGR2 Interfaces for extensible fixed memory manager. This kind of memory manager starts with a fixed memory pool but when it runs out, the manager will call out and ask for more memory. More...
struct  FPDFEMB_MEMMGR_EX
 Structure: FPDFEMB_MEMMGR_EX This is an extended version of memory manager interface, allowing advanced memory management, including movable and discardable memory blocks. More...
struct  FPDFEMB_FILE_ACCESS
 Structure: FPDFEMB_FILE_ACCESS Describe the way to access a file (readonly). More...
struct  FPDFEMB_PAUSE
 Structure: FPDFEMB_PAUSE An interface for pausing a progressive process. More...
struct  FPDFEMB_RECT
 Structure: FPDFEMB_RECT Rectangle area in device or page coordination system. More...
struct  FPDFEMB_POINT
 Structure: FPDFEMB_POINT A point in device or page coordination system. More...
struct  FPDFEMB_CHAR_INFO
 Structure: FPDFEMB_CHAR_INFO Character information. More...
struct  FPDFEMB_FONT_MAPPER
 Structure: FPDFEMB_FONT_MAPPER Defines interface for system font mapper. More...
struct  FPDFEMB_GLYPH_PROVIDER
 Structure: FPDFEMB_GLYPH_PROVIDER Interface for providing glyph bitmap of non-latin characters. This is usually used for embedded devices with Chinese/Japanese/Korean fonts installed, but those fonts are not in TrueType or Type1 format. More...
struct  FPDFEMB_PAGEDEST
 Data structure for page destination. More...
struct  FPDFEMB_DOCDEST
 Data structure for document destination. More...
struct  FPDFEMB_URLDEST
 Data structure for URL destination. More...
struct  FPDFEMB_LAUNCHACTION
 Data structure for Launch action. More...
struct  FPDFEMB_TEXTMATRIX
 Text matrix for FPDFEMB. More...

Defines

Error codes for FPDFEMB SDK
#define FPDFERR_SUCCESS   0
 Success.
#define FPDFERR_MEMORY   1
 Out of memory.
#define FPDFERR_ERROR   2
 Error of any kind, without specific reason.
#define FPDFERR_PASSWORD   3
 Incorrect password.
#define FPDFERR_FORMAT   4
 File or data format error.
#define FPDFERR_FILE   5
 File access error.
#define FPDFERR_PARAM   6
 Parameter error.
#define FPDFERR_STATUS   7
 Not in correct status.
#define FPDFERR_TOBECONTINUED   8
 To be continued.
#define FPDFERR_NOTFOUND   9
 Search result not found.
Memory Management Flags
#define FPDFEMB_NONLEAVE   1
 Non-leave.
#define FPDFEMB_MOVABLE   2
 Movable.
#define FPDFEMB_DISCARDABLE   4
 Discardable.
Render flags.
#define FPDFEMB_ANNOT   0x01
 Set if annotations are to be rendered.
#define FPDFEMB_LCD_TEXT   0x02
 Set if using text rendering optimized for LCD display.
#define FPDFEMB_BGR_STRIPE   0x04
 Set if the device is using BGR LCD stripe.
Search flags for FPDFEMB_FindFirst function.
#define FPDFEMB_MATCHCASE   1
 whether matching case.
#define FPDFEMB_MATCHWHOLEWORD   2
 whether matching whole word.
#define FPDFEMB_CONSECUTIVE   4
DIB format.
#define FPDFDIB_BGR   1
 3 bytes per pixel, byte order: Blue, Green, Red.
#define FPDFDIB_BGRx   2
 4 bytes per pixel, byte order: Blue, Green, Red, not used.
#define FPDFDIB_BGRA   3
 4 bytes per pixel, byte order: Blue, Green, Red, Alpha.
#define FPDFDIB_GRAY   4
 1 byte per pixel (grayscale).
Charset defines.
#define FPDFEMB_CHARSET_DEFAULT   0
 Default.
#define FPDFEMB_CHARSET_GB   936
 For simplified Chinese.
#define FPDFEMB_CHARSET_BIG5   950
 For traditional Chinese.
#define FPDFEMB_CHARSET_JIS   932
 For Japanese.
#define FPDFEMB_CHARSET_KOREA   949
 For Korea.
#define FPDFEMB_CHARSET_UNICODE   1200
 Unicode.
Font flags.
#define FPDFEMB_FONT_FIXEDPITCH   1
 Fixed pitch.
#define FPDFEMB_FONT_SERIF   2
 Serif.
#define FPDFEMB_FONT_SYMBOLIC   4
 Symbolic.
#define FPDFEMB_FONT_SCRIPT   8
 Script.
#define FPDFEMB_FONT_NONSYMBOLIC   32
 Non-symbolic.
#define FPDFEMB_FONT_ITALIC   64
 Italic.
#define FPDFEMB_FONT_ALLCAP   0x10000
 All cap.
#define FPDFEMB_FONT_SMALLCAP   0x20000
 Small cap.
#define FPDFEMB_FONT_FORCEBOLD   0x40000
 Force bold.
Action types supported by FPDFEMB
#define FPDFEMB_DEST_NONE   0
 No or unsupported destination.
#define FPDFEMB_DEST_PAGE   1
 A page inside the same document.
#define FPDFEMB_DEST_DOC   2
 An external PDF document.
#define FPDFEMB_DEST_URL   3
 An external URL.
#define FPDFEMB_ACTION_LAUNCH   4
 Launch an external file or command.
Zoom mode for destination.
#define FPDFEMB_ZOOM_NONE   0
 Zoom mode not specified.
#define FPDFEMB_ZOOM_FACTOR   1
 Specific zoom factor is used.
#define FPDFEMB_ZOOM_FITPAGE   2
 Fit the whole page on screen.
#define FPDFEMB_ZOOM_FITWIDTH   3
 Fit width of the page on screen.
#define FPDFEMB_ZOOM_FITHEIGHT   4
 Fit height of the page on screen.
#define FPDFEMB_ZOOM_FITRECT   5
 Fit a particular rectangle on screen.
#define FPDFEMB_ZOOM_FITCONTENT   6
 Fit whole content of page on screen.
#define FPDFEMB_ZOOM_FITCONTENTW   7
 Fit content width of page on screen.
#define FPDFEMB_ZOOM_FITCONTENTH   8
 Fit content height of page on screen.
Standard font ID
#define FPDFEMB_FONT_COURIER   0
 Courier.
#define FPDFEMB_FONT_COURIER_B   1
 bold. Courier-Bold.
#define FPDFEMB_FONT_COURIER_BI   2
 bold italic. Courier-BoldOblique.
#define FPDFEMB_FONT_COURIER_I   3
 italic. Courier-Oblique.
#define FPDFEMB_FONT_HELVETICA   4
 Helvetica.
#define FPDFEMB_FONT_HELVETICA_B   5
 bold. Helvetica-Bold.
#define FPDFEMB_FONT_HELVETICA_BI   6
 bold italic. Helvetica-BoldOblique.
#define FPDFEMB_FONT_HELVETICA_I   7
 italic. Helvetica-Oblique.
#define FPDFEMB_FONT_TIMES   8
 Times-Roman.
#define FPDFEMB_FONT_TIMES_B   9
 bold. Times-Bold.
#define FPDFEMB_FONT_TIMES_BI   10
 bold italic. Times-BoldItalic.
#define FPDFEMB_FONT_TIMES_I   11
 italic. Times-Italic.
#define FPDFEMB_FONT_SYMBOL   12
 Symbol.
#define FPDFEMB_FONT_ZAPF_DINGBATS   13
 ZapfDingbats.
Font encodings
#define FPDFEMB_ENCODING_INTERNAL   0
 Whatever internal encoding in the font.
#define FPDFEMB_ENCODING_UNICODE   1
 Unicode encoding.

Typedefs

typedef int FPDFEMB_RESULT
 Standard return type for many FPDFEMB functions: FPDFERR_SUCCESS for success, otherwise error code.
typedef int FPDFEMB_BOOL
 Standard boolean type: 0 for false, non-zero for true.
typedef unsigned short FPDFEMB_WCHAR
 Unicode character. FPDFEMB uses UTF16LE format for unicode string.
typedef void(* FPDFEMB_FIXED_OOM_HANDLER )(void *memory, int size)
 Fixed memory OOM(out-of-memory) handler type.
typedef void * FPDFEMB_DOCUMENT
 PDF document handle type.
typedef void * FPDFEMB_PAGE
 PDF page handle type.
typedef void * FPDFEMB_BITMAP
 Bitmap handle type.
typedef void * FPDFEMB_ACTION
 PDF action handle type.
typedef void * FPDFEMB_BOOKMARK
 PDF bookmark handle type.
typedef void * FPDFEMB_FONT
 PDF font handle type.

Functions

FPDFEMB_RESULT FPDFEMB_Init (struct FPDFEMB_MEMMGR *mem_mgr)
 Function: FPDFEMB_Init Initialize the FPDFEMB module.
FPDFEMB_RESULT FPDFEMB_InitFixedMemory (void *memory, int size, FPDFEMB_FIXED_OOM_HANDLER oom_handler)
 Function: FPDFEMB_InitFixedMemory Initialize the FPDFEMB module, providing a fixed memory heap.
FPDFEMB_RESULT FPDFEMB_InitFixedMemory2 (void *memory, int size, struct FPDFEMB_MEMMGR2 *callbacks, FPDFEMB_FIXED_OOM_HANDLER oom_handler)
 Function: FPDFEMB_InitFixedMemory2 Initialize FPDFEMB using an extensible fixed memory manager. With this kind of manager, when current memory pool runs out, the application may provide some additional memory block for the manager to use.
FPDFEMB_RESULT FPDFEMB_InitEx (struct FPDFEMB_MEMMGR_EX *mem_mgr)
 Function: FPDFEMB_InitEx Initialize the FPDFEMB module with the extended memory manager Comments:
This function will allocate necessary internal data structure for the whole module to operate.
void FPDFEMB_Exit ()
 Function: FPDFEMB_Exit Stop using FPDFEMB module and release all resources Comments:
All loaded documents and pages will become invalid after this call.
void * FPDFEMB_AllocMemory (unsigned int size)
void FPDFEMB_FreeMemory (void *pointer)
void FPDFEMB_FreeCaches ()
FPDFEMB_RESULT FPDFEMB_StartLoadDocument (struct FPDFEMB_FILE_ACCESS *file, const char *password, FPDFEMB_DOCUMENT *document, struct FPDFEMB_PAUSE *pause)
FPDFEMB_RESULT FPDFEMB_ContinueLoadDocument (FPDFEMB_DOCUMENT document, struct FPDFEMB_PAUSE *pause)
 Function: FPDFEMB_ContinueLoadDocument Continue loading a PDF document.
FPDFEMB_RESULT FPDFEMB_CloseDocument (FPDFEMB_DOCUMENT document)
int FPDFEMB_GetPageCount (FPDFEMB_DOCUMENT document)
void FPDFEMB_SetFileBufferSize (int size)
FPDFEMB_RESULT FPDFEMB_LoadPage (FPDFEMB_DOCUMENT document, int index, FPDFEMB_PAGE *page)
FPDFEMB_RESULT FPDFEMB_ClosePage (FPDFEMB_PAGE page)
FPDFEMB_RESULT FPDFEMB_GetPageSize (FPDFEMB_PAGE page, int *width, int *height)
FPDFEMB_RESULT FPDFEMB_GetPageBBox (FPDFEMB_PAGE page, struct FPDFEMB_RECT *rect)
FPDFEMB_RESULT FPDFEMB_StartParse (FPDFEMB_PAGE page, FPDFEMB_BOOL text_only, struct FPDFEMB_PAUSE *pause)
FPDFEMB_RESULT FPDFEMB_ContinueParse (FPDFEMB_PAGE page, struct FPDFEMB_PAUSE *pause)
int FPDFEMB_GetParseProgress (FPDFEMB_PAGE page)
FPDFEMB_RESULT FPDFEMB_StartQuickDraw (FPDFEMB_BITMAP dib, FPDFEMB_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags, struct FPDFEMB_PAUSE *pause)
FPDFEMB_RESULT FPDFEMB_ContinueQuickDraw (FPDFEMB_PAGE page, struct FPDFEMB_PAUSE *pause)
FPDFEMB_RESULT FPDFEMB_StartRender (FPDFEMB_BITMAP dib, FPDFEMB_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags, struct FPDFEMB_RECT *clip, struct FPDFEMB_PAUSE *pause)
FPDFEMB_RESULT FPDFEMB_ContinueRender (FPDFEMB_PAGE page, struct FPDFEMB_PAUSE *pause)
int FPDFEMB_GetRenderProgress (FPDFEMB_PAGE page)
void FPDFEMB_SetHalftoneLimit (int limit)
void FPDFEMB_DeviceToPagePoint (FPDFEMB_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, struct FPDFEMB_POINT *point)
void FPDFEMB_DeviceToPageRect (FPDFEMB_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, struct FPDFEMB_RECT *rect)
void FPDFEMB_PageToDevicePoint (FPDFEMB_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, struct FPDFEMB_POINT *point)
void FPDFEMB_PageToDeviceRect (FPDFEMB_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, struct FPDFEMB_RECT *rect)
FPDFEMB_RESULT FPDFEMB_FindFirst (FPDFEMB_PAGE page, const FPDFEMB_WCHAR *pattern, FPDFEMB_BOOL from_last, unsigned int flags)
FPDFEMB_RESULT FPDFEMB_FindFrom (FPDFEMB_PAGE page, const FPDFEMB_WCHAR *pattern, int pos, unsigned int flags)
FPDFEMB_RESULT FPDFEMB_FindNext (FPDFEMB_PAGE page)
FPDFEMB_RESULT FPDFEMB_FindPrev (FPDFEMB_PAGE page)
int FPDFEMB_CountFoundRects (FPDFEMB_PAGE page)
FPDFEMB_RESULT FPDFEMB_GetFoundRect (FPDFEMB_PAGE page, int index, struct FPDFEMB_RECT *rect)
int FPDFEMB_GetSearchPos (FPDFEMB_PAGE page)
FPDFEMB_RESULT FPDFEMB_QuickSearch (FPDFEMB_DOCUMENT document, int page_index, const FPDFEMB_WCHAR *pattern, int case_sensitive)
FPDFEMB_RESULT FPDFEMB_GetCharCount (FPDFEMB_PAGE page, int *count)
FPDFEMB_RESULT FPDFEMB_GetCharInfo (FPDFEMB_PAGE page, int index, struct FPDFEMB_CHAR_INFO *char_info)
FPDFEMB_RESULT FPDFEMB_GetCharIndexAtPos (FPDFEMB_PAGE page, double x, double y, int *index)
FPDFEMB_RESULT FPDFEMB_CreateDIB (int width, int height, int format, void *buffer, int stride, FPDFEMB_BITMAP *dib)
FPDFEMB_RESULT FPDFEMB_DestroyDIB (FPDFEMB_BITMAP dib)
int FPDFEMB_GetDIBWidth (FPDFEMB_BITMAP dib)
int FPDFEMB_GetDIBHeight (FPDFEMB_BITMAP dib)
void * FPDFEMB_GetDIBData (FPDFEMB_BITMAP dib)
int FPDFEMB_GetDIBStride (FPDFEMB_BITMAP dib)
FPDFEMB_RESULT FPDFEMB_GetRotatedDIB (FPDFEMB_BITMAP dib, FPDFEMB_BOOL bFlipX, FPDFEMB_BOOL bFlipY, FPDFEMB_BITMAP *result_dib)
FPDFEMB_RESULT FPDFEMB_StretchDIB (FPDFEMB_BITMAP dest_dib, int dest_left, int dest_top, int dest_width, int dest_height, struct FPDFEMB_RECT *clip_rect, FPDFEMB_BITMAP src_dib, FPDFEMB_BOOL interpol)
FPDFEMB_RESULT FPDFEMB_TransformDIB (FPDFEMB_BITMAP dest_dib, struct FPDFEMB_RECT *clip_rect, FPDFEMB_BITMAP src_dib, int x, int y, int xx, int yx, int xy, int yy, FPDFEMB_BOOL interpol)
FPDFEMB_RESULT FPDFEMB_SetFontMapper (struct FPDFEMB_FONT_MAPPER *mapper)
void FPDFEMB_SetGlyphProvider (struct FPDFEMB_GLYPH_PROVIDER *provider)
void FPDFEMB_UseExternalData (const unsigned char *data, unsigned int size)
void FPDFEMB_LoadCMap_GB ()
void FPDFEMB_LoadCMap_GB_Ext ()
void FPDFEMB_LoadCMap_CNS ()
void FPDFEMB_LoadCMap_Korea ()
void FPDFEMB_LoadCMap_Japan ()
void FPDFEMB_LoadCMap_Japan_Ext ()
FPDFEMB_RESULT FPDFEMB_GetDocInfoString (FPDFEMB_DOCUMENT document, const char *key, void *buffer, unsigned int *bufsize)
FPDFEMB_RESULT FPDFEMB_Action_GetType (FPDFEMB_DOCUMENT document, FPDFEMB_ACTION action, int *dest_type, int *data_size)
FPDFEMB_RESULT FPDFEMB_Action_GetData (FPDFEMB_DOCUMENT document, FPDFEMB_ACTION action, void *buffer)
FPDFEMB_RESULT FPDFEMB_Action_GetNext (FPDFEMB_ACTION action, FPDFEMB_ACTION *next)
FPDFEMB_RESULT FPDFEMB_Bookmark_GetFirstChild (FPDFEMB_DOCUMENT document, FPDFEMB_BOOKMARK parent, FPDFEMB_BOOKMARK *bookmark)
FPDFEMB_RESULT FPDFEMB_Bookmark_GetNextSibling (FPDFEMB_DOCUMENT document, FPDFEMB_BOOKMARK bookmark, FPDFEMB_BOOKMARK *sibling)
FPDFEMB_RESULT FPDFEMB_Bookmark_GetTitle (FPDFEMB_BOOKMARK bookmark, void *buffer, unsigned int *bufsize)
FPDFEMB_RESULT FPDFEMB_Bookmark_GetPage (FPDFEMB_DOCUMENT document, FPDFEMB_BOOKMARK bookmark, int *page)
FPDFEMB_RESULT FPDFEMB_Bookmark_GetAction (FPDFEMB_DOCUMENT document, FPDFEMB_BOOKMARK bookmark, FPDFEMB_ACTION *action)
FPDFEMB_RESULT FPDFEMB_Link_GetCount (FPDFEMB_PAGE page, int *link_count, int reserved)
FPDFEMB_RESULT FPDFEMB_Link_GetAction (FPDFEMB_PAGE page, int link_index, FPDFEMB_ACTION *action)
FPDFEMB_RESULT FPDFEMB_Link_GetAreaCount (FPDFEMB_PAGE page, int link_index, int *count)
FPDFEMB_RESULT FPDFEMB_Link_GetArea (FPDFEMB_PAGE page, int link_index, int area_index, struct FPDFEMB_POINT *points)
FPDFEMB_RESULT FPDFEMB_OpenStandardFont (int font_id, FPDFEMB_FONT *font_handle)
FPDFEMB_RESULT FPDFEMB_OpenFileFont (struct FPDFEMB_FILE_ACCESS *file, FPDFEMB_FONT *font_handle)
FPDFEMB_RESULT FPDFEMB_CloseFont (FPDFEMB_FONT font_handle)
FPDFEMB_RESULT FPDFEMB_GetGlyphIndex (FPDFEMB_FONT font_handle, int encoding, unsigned long char_code, unsigned long *glyph_index)
FPDFEMB_RESULT FPDFEMB_GetGlyphWidth (FPDFEMB_FONT font_handle, unsigned long glyph_index, unsigned long *width)
FPDFEMB_RESULT FPDFEMB_OutputGlyph (FPDFEMB_BITMAP dib, int x, int y, FPDFEMB_FONT font_handle, double font_size, struct FPDFEMB_TEXTMATRIX *matrix, unsigned long glyph_index, unsigned long argb)
FPDFEMB_RESULT FPDFEMB_OutputText (FPDFEMB_BITMAP dib, int x, int y, FPDFEMB_FONT font_handle, double font_size, struct FPDFEMB_TEXTMATRIX *matrix, const FPDFEMB_WCHAR *text, unsigned long argb)
void FPDFEMB_SetLogProc (void(*proc)(const char *msg))
FPDFEMB_RESULT FPDFEMB_GetContentMargin (FPDFEMB_PAGE page, int *left, int *top, int *right, int *bottom, unsigned long backcolor)
FPDFEMB_RESULT FPDFEMB_GetPageLabel (FPDFEMB_DOCUMENT document, int nPage, void *buffer, unsigned int *bufsize)
FPDFEMB_RESULT FPDFEMB_PageLabelToPageNum (FPDFEMB_DOCUMENT document, FPDFEMB_WCHAR *pagelabel, int *pageNum)
Enable JBIG2 or JPEG2000 image decoder.

Comments:
If you want to display JBIG2 or JPEG2000 encoded images, you need to call these functions after FPDFEMB initialized.

Calling these functions will increase code size by about 200K-400K bytes. Also JPEG2000 decoder may not be available on some platforms.

void FPDFEMB_LoadJbig2Decoder ()
void FPDFEMB_LoadJpeg2000Decoder ()

Detailed Description

Header file for FPDFEMB SDK.

Copyright (c) 2007-2010 Foxit Corporation, All Right Reserved.

Date: 2010-06-29

Embedded platforms have many different aspects from desktop platforms, among them, the followings are most important for PDF processing:

1. Embedded platforms have only limited memory, and there is no virtual memory. PDF is a very complicated format, processing PDF may consumes quite large amount of memory, even for some smaller PDFs. And, in order to increase the performance of PDF parsing and rendering, cache memory is often used. For some big PDFs with many pages, the cache may grow while user browing through pages, eventually, for some PDFs, the memory on the device may run out.

FPDFEMB SDK allows graceful out-of-memory (OOM) handling by returning OOM error code for all functions that may involve memory allocation. When an application detects OOM situation, it can do one of the followings:

a) Give user some prompt and quit the application or close the document;
b) Or better, try to recover from the error. Sometimes OOM can be caused by ever-growing cache. For example, when user browses a 1000-page document, let's say OOM happen at page #300. In this case, the application might close the whole document (cache will be gone with it), reopen the document, then go directly to page #300. It's likely the process will go through this time. This is called "OOM recovery". If OOM happens again during a recovery, then, it's not possible to finish the process, the application must quit of close the document.

2. Embedded platforms has only limited computing power. Since some PDFs can be very complicated and require a lot of processing to be displayed, it may take a lot of time for the process to finish. This may cause some problem with user experience, especially for devices like mobile phones, when an application may need to be put on hold any time. Therefore, it's important to break lengthy process into small steps which can be stopped or resumed at any time. We call this kind of process as "progressive process".

FPDFEMB SDK allows progressive page parsing and rendering, the most time- consuming part of PDF processing.

IMPORTANT:
FPDFEMB module is not intended to run in multi-threaded environment.

Components inside FPDFEMB:

 All Data Structures Files Functions Variables Typedefs Defines