Foxit Embedded PDF SDK
Data Structures | Files | Typedefs | Functions

FPDFAPI

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...

Files

file  fpdfemb.h
 

Header file for FPDFEMB SDK.


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)

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.

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 ()

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.

Define Documentation

#define FPDFEMB_CONSECUTIVE   4

whether matching consecutively (for example, "CC" will match twice in "CCC").


Function Documentation

FPDFEMB_RESULT FPDFEMB_Action_GetData ( FPDFEMB_DOCUMENT  document,
FPDFEMB_ACTION  action,
void *  buffer 
)

Function: FPDFEMB_Action_GetData Get detailed data of a particular action Comments: See data structure definition for different action type above. Please note the actual action data might use more space than the structure definition shows, to store things like file name or URL. So you should always call FPDFEMB_Action_GetType first to get data size then allocate enough buffer for this call.

Parameters:
[in]documentHandle to the document
[in]actionHandle to the action
[out]bufferApplication allocated buffer receiving the destination data
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_Action_GetNext ( FPDFEMB_ACTION  action,
FPDFEMB_ACTION next 
)

Function: FPDFEMB_Action_GetNext Get next action in an action chain

Comments: If there is no next action, the "next" parameter will be set to NULL after the function returns.

Parameters:
[in]actionHandle to current action
[out]nextReceiving handle to next action.
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_Action_GetType ( FPDFEMB_DOCUMENT  document,
FPDFEMB_ACTION  action,
int *  dest_type,
int *  data_size 
)

Function: FPDFEMB_Action_GetType Get type of an action

Comments: Each different type of destination has different data structure. The "data_size" result indicates how many bytes is required to hold the destination data structure. The application can then allocate sufficient buffer and then call FPDFEMB_Bookmark_GetDest function to get the real data.

Parameters:
[in]documentHandle to the document
[in]actionHandle to the action
[out]dest_typePointer to an integer receiving type of the destination. See the above FPDFEMB_DEST_xxx definitions
[out]data_sizePointer to an integer receiving data block size for the destination. If this parameter is NULL, then data size won't be retrieved.
Returns:
Error code, or FPDFERR_SUCCESS for success.
void* FPDFEMB_AllocMemory ( unsigned int  size)

Function: FPDFEMB_AllocMemory Allocate memory

Parameters:
[in]sizeNumber of bytes
Returns:
The allocated buffer pointer. NULL for out of memory.
FPDFEMB_RESULT FPDFEMB_Bookmark_GetAction ( FPDFEMB_DOCUMENT  document,
FPDFEMB_BOOKMARK  bookmark,
FPDFEMB_ACTION action 
)

Function: FPDFEMB_Bookmark_GetAction Get action(s) associated with a particular bookmark

Parameters:
[in]documentHandle to the document
[in]bookmarkHandle to the bookmark
[out]actionReceiving handle of first action
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_Bookmark_GetFirstChild ( FPDFEMB_DOCUMENT  document,
FPDFEMB_BOOKMARK  parent,
FPDFEMB_BOOKMARK bookmark 
)

Function: FPDFEMB_Bookmark_GetFirstChild Get first child of a bookmark item, or first top level bookmark item

Parameters:
[in]documentHandle to the document
[in]parentHandle to the parent bookmark. Can be NULL if you want to get the first top level item.
[out]bookmarkReceiving handle to the first child or top level bookmark item. If result is NULL, then bookmark not found.
Returns:
Error code, or FPDFERR_SUCCESS for success
FPDFEMB_RESULT FPDFEMB_Bookmark_GetNextSibling ( FPDFEMB_DOCUMENT  document,
FPDFEMB_BOOKMARK  bookmark,
FPDFEMB_BOOKMARK sibling 
)

Function: FPDFEMB_Bookmark_GetNextSibling Get next sibling of a bookmark item

Parameters:
[in]documentHandle to the document
[in]bookmarkHandle to the bookmark
[out]siblingReceiving the handle of next sibling. If result is NULL, then this is the last bookmark in this level.
Returns:
Error code, or FPDFERR_SUCCESS for success
FPDFEMB_RESULT FPDFEMB_Bookmark_GetPage ( FPDFEMB_DOCUMENT  document,
FPDFEMB_BOOKMARK  bookmark,
int *  page 
)

Function: FPDFEMB_Bookmark_GetPage Get page number of a bookmark pointing to

Comments: Some bookmark might not point to a page, some bookmark might have more than one destination (action), for detailed information about a bookmark, you should call FPDFEMB_Bookmark_GetAction.

Parameters:
[in]documentHandle to the document
[in]bookmarkHandle to the bookmark
[out]pageReceiving the page number. -1 if this bookmark doesn't actually point to a page inside the document.
Returns:
Error code, or FPDFERR_SUCCESS for success
FPDFEMB_RESULT FPDFEMB_Bookmark_GetTitle ( FPDFEMB_BOOKMARK  bookmark,
void *  buffer,
unsigned int *  bufsize 
)

Function: FPDFEMB_Bookmark_GetTitle Get title of a bookmark

Comments: The title is output in Unicode, using UTF-16LE format. It's terminated by two consecutive zero bytes.

If the "buffer" parameter is NULL, then the "bufsize" parameter will receive number of bytes required to store the bookmark title (including the two- byte terminator).

If the buffer provided is smaller than the required size, then this function will not copy any data, return FPDFEMB_PARAM, and the required buffer size will also be put in "bufsize" parameter.

Parameters:
[in]bookmarkHandle to the bookmark
[out]bufferA buffer allocated by the application, or NULL.
[in,out]bufsizeA pointer to a number indicating the buffer size, before this function call. After return, this place will store number of bytes used by the output (including terminator).
Returns:
Error code, or FPDFERR_SUCCESS for success
FPDFEMB_RESULT FPDFEMB_CloseDocument ( FPDFEMB_DOCUMENT  document)

Function: FPDFEMB_CloseDocument Close a PDF document and free all associated resources

Parameters:
[in]documentDocument handle
Returns:
Error code. FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_CloseFont ( FPDFEMB_FONT  font_handle)

Function: FPDFEMB_CloseFont Close a font handle.

Parameters:
[in]font_handleHandle to the font.
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_ClosePage ( FPDFEMB_PAGE  page)

Function: FPDFEMB_ClosePage Close a page and release all related resources

Parameters:
[in]pagePage handle
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_ContinueLoadDocument ( FPDFEMB_DOCUMENT  document,
struct FPDFEMB_PAUSE pause 
)

Function: FPDFEMB_ContinueLoadDocument Continue loading a PDF document.

Parameters:
[in]documentDocument handle returned by FPDFEMB_StartLoadDocument function
[in]pauseA callback mechanism allowing the document loading process to be paused before it's finished. This can be NULL if you don't want to pause.
Return values:
FPDFERR_SUCCESSdocument successfully loaded.
FPDFERR_TOBECONTINUEDThe document loading can't be finished now. Further call to this function is needed.
FPDFERR_PASSWORDincorrect password.
FPDFERR_FORMATnot a PDF or corrupted PDF.
FPDFERR_FILEfile access error.
FPDFERR_MEMORYout of memory.
FPDFERR_STATUSdocument already loaded.
FPDFERR_PARAMinvalid parameter (like NULL document handle)
FPDFEMB_RESULT FPDFEMB_ContinueParse ( FPDFEMB_PAGE  page,
struct FPDFEMB_PAUSE pause 
)

Function: FPDFEMB_ContinueParse Continue the page parsing.

Comments:
FPDFEMB_StartParse should be called before on the page.

Application should call FPDFEMB_ContinueParse repeatedly to finish the parsing when return value is FPDFERR_TOBECONTINUED.

Parameters:
[in]pagePage handle
[in]pauseA structure that can pause the parsing process. Or NULL if you don't want to pause the process.
Return values:
FPDFERR_SUCCESSparsing successfully finished;
FPDFERR_TOBECONTINUEDparsing performed successfully, but not finished;
FPDFERR_STATUSpage already parsed (or parsing not started).
Otherreturn value error code.
FPDFEMB_RESULT FPDFEMB_ContinueQuickDraw ( FPDFEMB_PAGE  page,
struct FPDFEMB_PAUSE pause 
)

Function: FPDFEMB_ContinueQuickDraw Continue a quick draw processing

Parameters:
[in]pagePage handle. The page has to be parsed first.
[in]pausePointer to a structure that can pause the rendering process. Can be NULL if no pausing is needed.
Return values:
FPDFERR_SUCCESSquickdraw successly finished;
FPDFERR_TOBECONTINUEDquickdraw started successfully, but not finished. more calls to this function needed to finish the quickdraw;
FPDFERR_STATUSquickdraw not started yet;
Otherreturn value error code.
FPDFEMB_RESULT FPDFEMB_ContinueRender ( FPDFEMB_PAGE  page,
struct FPDFEMB_PAUSE pause 
)

Function: FPDFEMB_ContinueRender Continue the page rendering

Comments:
This function may return any time when the pause interface indicates a pause is needed. Application can call FPDFEMB_ContinueRender any number of times, until FPDFERR_TOBECONTINUED is not returned.

Parameters:
[in]pagePage handle
[in]pausePointer to a structure that can pause the rendering process. Can be NULL if no pausing is needed.
Return values:
FPDFERR_SUCCESSrendering successfully finished.
FPDFERR_TOBECONTINUEDrendering needs to be continued;
Otherreturn value error code.
int FPDFEMB_CountFoundRects ( FPDFEMB_PAGE  page)

Function: FPDFEMB_CountFoundRects Get number of rectangles for last found result

Parameters:
[in]pagePage handle.
Returns:
Number of rectangles for last found result. 0 for not found or failure.
FPDFEMB_RESULT FPDFEMB_CreateDIB ( int  width,
int  height,
int  format,
void *  buffer,
int  stride,
FPDFEMB_BITMAP dib 
)

Function: FPDFEMB_CreateDIB Create a DIB (Device Independent Bitmap)

Comments: If "buffer" parameter is not NULL, then the provided buffer must conform to standard DIB format (see comments of FPDFEMB_GetDIBData function below).

This function doesn't initialize the pixels inside the DIB buffer. So if you want to use the DIB to display a PDF page, you usually need to initialize the DIB to white background by youself.

Parameters:
[in]widthWidth pixels;
[in]heightHeight pixels;
[in]formatFormat type. See FPDFDIB_xxx constants
[in]bufferExternal buffer provided for the DIB, or NULL if new buffer is to be allocated.
[in]strideNumber of bytes for each scan line, for external buffer only. If not specified, 4-byte alignment assumed.
[out]dibReceiving the created DIB handle
Returns:
Error code, or FPDFERR_SUCCESS for success
FPDFEMB_RESULT FPDFEMB_DestroyDIB ( FPDFEMB_BITMAP  dib)

Function: FPDFEMB_DestroyDIB Destroy a DIB

Comments: If external buffer is used (specified in "buffer" parameter when calling FPDFEMB_CreateDIB), the buffer will not be destroyed.

Parameters:
[in]dibDIB handle
Returns:
Error code, or FPDFERR_SUCCESS for success
void FPDFEMB_DeviceToPagePoint ( FPDFEMB_PAGE  page,
int  start_x,
int  start_y,
int  size_x,
int  size_y,
int  rotate,
struct FPDFEMB_POINT point 
)

Function: FPDFEMB_DeviceToPagePoint, FPDFEMB_DeviceToPageRect Convert the device coordinations of a point or a rectangle to page coordinations.

Comments:
The page coordination system has its origin at left-bottom corner of the page, with X axis goes along the bottom side to the right, and Y axis goes along the left side upward. No matter how you zoom, scroll, or rotate a page, a particular element (like text or image) on the page should always have the same coordination values in the page coordination system.

The device coordination system is device dependent. For bitmap device, its origin is at left-top corner of the window. You must make sure the start_x, start_y, size_x, size_y and rotate parameters have exactly same values as you used in FPDFEMB_StartRender() function call.

For rectangle conversion, the result rectangle is always "normalized", meaning for page coordinations, left is always smaller than right, bottom is smaller than top.

Parameters:
[in]pageHandle to the page. Returned by FPDFEMB_LoadPage function.
[in]start_xLeft pixel position of the display area in the device coordination
[in]start_yTop pixel position of the display area in the device coordination
[in]size_xHorizontal size (in pixels) for displaying the page
[in]size_yVertical size (in pixels) for displaying the page
[in]rotatePage orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
[in,out]pointA point structure with device coordinations upon the call, also receiving the result page coordinations.
void FPDFEMB_DeviceToPageRect ( FPDFEMB_PAGE  page,
int  start_x,
int  start_y,
int  size_x,
int  size_y,
int  rotate,
struct FPDFEMB_RECT rect 
)
See also:
FPDFEMB_DeviceToPagePoint()
Parameters:
[in]pageHandle to the page. Returned by FPDFEMB_LoadPage function.
[in]start_xLeft pixel position of the display area in the device coordination
[in]start_yTop pixel position of the display area in the device coordination
[in]size_xHorizontal size (in pixels) for displaying the page
[in]size_yVertical size (in pixels) for displaying the page
[in]rotatePage orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
[in,out]rectA rectangle structure with device coordinations upon the call, also receiving the result page coordinations.
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.

This function is useful for OOM recovery: when your application hits an OOM situation, calling this function will clear all memory allocated by FPDFEMB module, then you can call one of the initialization functions, reopen the document and recovery from OOM.

FPDFEMB_RESULT FPDFEMB_FindFirst ( FPDFEMB_PAGE  page,
const FPDFEMB_WCHAR pattern,
FPDFEMB_BOOL  from_last,
unsigned int  flags 
)

Function: FPDFEMB_FindFirst Find first occurrence of a pattern string in a page

Comments:
A page must be parsed first before it can be searched. There can be only one search in progress for a page. A new search will cancel the previous one.

IMPORTANT: this function is now obsolete and kept for back compatibility only, please use FPDFEMB_FindFrom function below.

Parameters:
[in]pagePage handle.
[in]patternA zero-terminated unicode string to be found.
[in]from_lastWhether we start from the end of page
[in]flagsSearch flags, see above defined constants
Returns:
Error code, or FPDFERR_SUCCESS for success. Is not found, FPDFERR_NOTFOUND is returned.
FPDFEMB_RESULT FPDFEMB_FindFrom ( FPDFEMB_PAGE  page,
const FPDFEMB_WCHAR pattern,
int  pos,
unsigned int  flags 
)

Function: FPDFEMB_FindFrom Find first occurrence of a pattern string in a page, from a particular position

Comments: A page must be parsed first before it can be searched. There can be only one search in progress for a page. A new search will cancel the previous one.

Parameters:
[in]pagePage handle.
[in]patternA zero-terminated unicode string to be found.
[in]posThe position, returned from FPDFEMB_GetSearchPos. Or 0 from the beginning of page, -1 from the end of page.
[in]flagsSearch flags, see above defined constants
Returns:
Error code, or FPDFERR_SUCCESS for success. Is not found, FPDFERR_NOTFOUND is returned.
FPDFEMB_RESULT FPDFEMB_FindNext ( FPDFEMB_PAGE  page)

Function: FPDFEMB_FindNext Find next occurrence of a search

Parameters:
[in]pagePage handle. FPDFEMB_FindFirst must be called for this page first.
Returns:
Error code, or FPDFERR_SUCCESS for success. Is not found, FPDFERR_NOTFOUND is returned.
FPDFEMB_RESULT FPDFEMB_FindPrev ( FPDFEMB_PAGE  page)

Function: FPDFEMB_FindPrev Find previous occurrence of a search

Parameters:
[in]pagePage handle. FPDFEMB_FindFirst must be called for this page first.
Returns:
Error code, or FPDFERR_SUCCESS for success. Is not found, FPDFERR_NOTFOUND is returned.
void FPDFEMB_FreeCaches ( )

Function: FPDFEMB_FreeCaches Free all expendable caches used by FPDFEMB in order to save memory.

Comments:
When an application memory manager runs out of memory, before an OOM situation is raised, the application can try this

void FPDFEMB_FreeMemory ( void *  pointer)

Function: FPDFEMB_FreeMemory Free allocated memory

Parameters:
[in]pointerPointer returned by FPDFEMB_AllocMemory
FPDFEMB_RESULT FPDFEMB_GetCharCount ( FPDFEMB_PAGE  page,
int *  count 
)

Function: FPDFEMB_GetCharCount Get number of characters in the page

Parameters:
[in]pagePage handle
[out]countReceiving number of characters
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_GetCharIndexAtPos ( FPDFEMB_PAGE  page,
double  x,
double  y,
int *  index 
)

Function: FPDFEMB_GetCharIndexAtPos() Get index of character nearest to a certain position on the page

Comments: This function finds the character that's nearest to the particular page position. If there is no character, the output index will be -1.

Parameters:
[in]pagePage handle
[in]xX position in PDF page coordination system
[in]yY position in PDF page coordination system
[in]indexPointer to an integer receiving zero-based character index.
Returns:
Error code, or FPDFERR_SUCCESS for success
FPDFEMB_RESULT FPDFEMB_GetCharInfo ( FPDFEMB_PAGE  page,
int  index,
struct FPDFEMB_CHAR_INFO char_info 
)

Function: FPDFEMB_GetCharInfo Get character information

Comments: Application must call FPDFEMB_GetCharCount first before it can call this function for any particular characters.

Parameters:
[in]pagePage handle
[in]indexCharacter index, starting from zero
[out]char_infoReceiving the character info
Returns:
Error code, or FPDFERR_SUCCESS for success
FPDFEMB_RESULT FPDFEMB_GetContentMargin ( FPDFEMB_PAGE  page,
int *  left,
int *  top,
int *  right,
int *  bottom,
unsigned long  backcolor 
)

Function: FPDFEMB_GetContentMargin Get content margin

Parameters:
[in]pagePage handle
[out]leftReceiving the left margin (in hundredth of points)
[out]topReceiving the top margin (in hundredth of points)
[out]rightReceiving the right margin (in hundredth of points)
[out]bottomReceiving the bottom margin (in hundredth of points)
[in]backcolorColor for intended background in the page. In 0xRRGGBB format.
Returns:
Error code, or FPDFERR_SUCCESS for success.
void* FPDFEMB_GetDIBData ( FPDFEMB_BITMAP  dib)

Function: FPDFEMB_GetDIBData Get data pointer to a DIB

Comments: DIB data are organized in scanlines, from top down.

Parameters:
[in]dibDIB handle
Returns:
Pointer to the DIB data.
int FPDFEMB_GetDIBHeight ( FPDFEMB_BITMAP  dib)

Function: FPDFEMB_GetDIBHeight Get height (in pixels) of a DIB

Parameters:
[in]dibDIB handle
Returns:
DIB height in pixels.
int FPDFEMB_GetDIBStride ( FPDFEMB_BITMAP  dib)

Function: FPDFEMB_GetDIBStride Get scan line stride of a DIB

Parameters:
[in]dibDIB handle
Returns:
Number of bytes occupied by a scanline
int FPDFEMB_GetDIBWidth ( FPDFEMB_BITMAP  dib)

Function: FPDFEMB_GetDIBWidth Get width (in pixels) of a DIB

Parameters:
[in]dibDIB handle
Returns:
DIB width in pixels.
FPDFEMB_RESULT FPDFEMB_GetDocInfoString ( FPDFEMB_DOCUMENT  document,
const char *  key,
void *  buffer,
unsigned int *  bufsize 
)

Function: PDFEMB_GetDocInfoString Get information string about the document, like creator, modification date, etc.

Comments: The string is output in Unicode, using UTF-16LE format. It's terminated by two consecutive zero bytes.

If the "buffer" parameter is NULL, then the "bufsize" parameter will receive number of bytes required to store the string (including the two-byte terminator).

Parameters:
[in]documentHandle to the document
[in]keyA byte string for the information key. Currently can be one of the followings: "Title", "Author", "Subject", "Keywords", "Creator", "Producer", "CreationDate", "ModDate", or some custom information key, if supported by the PDF file.
[out]bufferA buffer allocated by the application, or NULL.
[in,out]bufsizeA pointer to a number indicating the buffer size (number of bytes), before this function call. After return, this place will store number of bytes used by the output (including terminator).
Returns:
Error code, or FPDFERR_SUCCESS for success
FPDFEMB_RESULT FPDFEMB_GetFoundRect ( FPDFEMB_PAGE  page,
int  index,
struct FPDFEMB_RECT rect 
)

Function: FPDFEMB_GetFoundRect Get a particular found rectangle

Comments: Application should always call FPDFEMB_CountFoundRects first to get number of rectangles, then use this function to get each rectangle.

The returned rectangle uses page coordination system.

Parameters:
[in]pagePage handle.
[in]indexZero-based index for the rectangle.
[out]rectReceiving the result rectangle, in hundredth of points
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_GetGlyphIndex ( FPDFEMB_FONT  font_handle,
int  encoding,
unsigned long  char_code,
unsigned long *  glyph_index 
)

Function: FPDFEMB_GetGlyphIndex Get glyph index of a character

Parameters:
[in]font_handleHandle to the font.
[in]encodingEncoding, see the above FPDFEMB_ENCODING_XXX definitions
[in]char_codeCharacter code, depends on the encoding used. For example, if "encoding" is FPDFEMB_ENCODING_UNICODE, then "char_code" should be unicode.
[out]glyph_indexReceiving the result glyph index.
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_GetGlyphWidth ( FPDFEMB_FONT  font_handle,
unsigned long  glyph_index,
unsigned long *  width 
)

Function: FPDFEMB_GetGlyphWidth Get width of a glyph in a font

Parameters:
[in]font_handleHandle to the font.
[in]glyph_indexIndex of the glyph in font.
[out]widthReceiving the character width, in 1/1000 of design size (em)
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_GetPageBBox ( FPDFEMB_PAGE  page,
struct FPDFEMB_RECT rect 
)

Function: FPDFEMB_GetPageBBox Get displayable area (bounding box) of a page

Parameters:
[in]pagePage handle
[out]rectPointer to a structure receiving the rectangle
Returns:
Error code, or FPDFERR_SUCCESS for success
int FPDFEMB_GetPageCount ( FPDFEMB_DOCUMENT  document)

Function: Get page count Get number of pages in the document

Parameters:
[in]documentDocument handle
Returns:
Number of pages.
FPDFEMB_RESULT FPDFEMB_GetPageLabel ( FPDFEMB_DOCUMENT  document,
int  nPage,
void *  buffer,
unsigned int *  bufsize 
)

Function: FPDFEMB_GetPageLabel Get Page label

Comments: The string is output in Unicode, using UTF-16LE format. It's terminated by two consecutive zero bytes.

If the "buffer" parameter is NULL, then the "bufsize" parameter will receive number of bytes required to store the string (including the two-byte terminator).

Parameters:
[in]documentHandle to the document
[out]nPagePage index
[out]bufferA buffer allocated by the application, or NULL.
[in,out]bufsizeA pointer to a number indicating the buffer size (number of bytes), before this function call. After return, this place will store number of bytes used by the output (including terminator).
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_GetPageSize ( FPDFEMB_PAGE  page,
int *  width,
int *  height 
)

Function: FPDFEMB_GetPageSize Get size of a page

Parameters:
[in]pagePage handle
[out]widthReceiving page width, in hundredth of points
[out]heightReceiving page height, in hundredth of points
Returns:
Error code, or FPDFERR_SUCCESS for success.
int FPDFEMB_GetParseProgress ( FPDFEMB_PAGE  page)

Function: FPDFEMB_GetParseProgress Get an estimated parsing progress in percentage

Parameters:
[in]pagePage handle
Returns:
An integer between 0 and 100 (inclusive) indicating the parsing progress. The result is just a rough estimation.
int FPDFEMB_GetRenderProgress ( FPDFEMB_PAGE  page)

Function: FPDFEMB_GetRenderProgress Get an estimated rendering progress in percentage

Parameters:
[in]pagePage handle
Returns:
An integer between 0 and 100 (inclusive) indicating the rendering progress. The result is just a rough estimation. If the rendering just finished, this function will return 0.
FPDFEMB_RESULT FPDFEMB_GetRotatedDIB ( FPDFEMB_BITMAP  dib,
FPDFEMB_BOOL  bFlipX,
FPDFEMB_BOOL  bFlipY,
FPDFEMB_BITMAP result_dib 
)

Function: FPDFEMB_GetRotatedDIB Swap X/Y dimensions of a DIB to generate a rotated new DIB

Parameters:
[in]dibDIB handle
[in]bFlipXWhether flip pixels on the destination X dimension (left/right)
[in]bFlipYWhether flip pixels on the destination Y dimension (up/down)
[out]result_dibReceiving the result DIB handle
Returns:
Error code, or FPDFERR_SUCCESS for success
int FPDFEMB_GetSearchPos ( FPDFEMB_PAGE  page)

Function: FPDFEMB_GetSearchPos Return position of current search result

Parameters:
[in]pagePage handle.
Returns:
Zero based character index for the current search result. -1 if not found.
FPDFEMB_RESULT FPDFEMB_Init ( struct FPDFEMB_MEMMGR mem_mgr)

Function: FPDFEMB_Init Initialize the FPDFEMB module.

Comments:
This function will allocate necessary internal data structure for the whole module to operate.

Parameters:
[in]mem_mgrPointer to memory manager structure.
Returns:
Error code, or FPDFERR_SUCCESS for success.
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.

Parameters:
[in]mem_mgrPointer to memory manager structure.
Returns:
Error code, or FPDFERR_SUCCESS for success.
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.

Comments:
In many embedded system, memory usage are predetermined. The application is assigned with fixed size of available memory, then it can pre-allocate a memory block with maximum size and pass to this function to initialize FPDFEMB module. In this case, FPDFEMB won't need any additional memory allocation.

In case the pre-allocated memory has run out, the "oom_proc" callback function will be called to notify the application that an OOM recovery procedure needs to be performed.

Parameters:
[in]memoryPointer to a pre-allocated memory block.
[in]sizeNumber of bytes in the memory block.
[in]oom_handlerPointer to a function which will be called when OOM happens. Can be NULL if application doesn't want to be notified om OOM.
Returns:
Error code, or FPDFERR_SUCCESS for success.
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.

Parameters:
[in]memoryPointer to a pre-allocated memory block
[in]sizeNumber of bytes in the memory block
[in]callbacksCallback functions when FPDFEMB runs out of current memory pool, or when a pool become empty and can be dropped
[in]oom_handlerPointer to a function which will be called when OOM happens. Can be NULL if application doesn't want to be notified om OOM.
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_Link_GetAction ( FPDFEMB_PAGE  page,
int  link_index,
FPDFEMB_ACTION action 
)

Function: FPDFEMB_Link_GetAction Get action(s) associated with a particular hyperlink

Parameters:
[in]pagePage handle
[in]link_indexZero-based index for the link
[out]actionReceiving handle of first action
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_Link_GetArea ( FPDFEMB_PAGE  page,
int  link_index,
int  area_index,
struct FPDFEMB_POINT points 
)

Function: FPDFEMB_Link_GetArea Get a particular quadrilateral for a link

Comments: The result in "points" array are the X/Y coordinations for the four vertices of the quadrilateral. Vertices are in the following order: lower left, lower right, upper right, upper left.

Parameters:
[in]pagePage handle
[in]link_indexZero-based index for the link
[in]area_indexZero-based index for the quadrilateral
[out]points- Pointer to an array consists 4 points, receiving coordinations
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_Link_GetAreaCount ( FPDFEMB_PAGE  page,
int  link_index,
int *  count 
)

Function: FPDFEMB_Link_GetAreaCount Get number of area (quadrilaterals) for a link

Parameters:
[in]pagePage handle
[in]link_indexZero-based index for the link
[out]countPointer to an integer receiving number of quadrilaterals
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_Link_GetCount ( FPDFEMB_PAGE  page,
int *  link_count,
int  reserved 
)

Function: FPDFEMB_Link_GetCount Get number of hyperlinks inside a page

Comments: This function must be called before any other link related function can be called for the page.

Parameters:
[in]pagePage handle.
[out]link_countPointer to an integer receiving the number of links
[in]reservedMust be zero now.
Returns:
Error code, or FPDFERR_SUCCESS for success.
void FPDFEMB_LoadCMap_CNS ( )
void FPDFEMB_LoadCMap_GB ( )

Function: FPDFEMB_LoadCMap_GB Function: FPDFEMB_LoadCMap_GB_Ext Function: FPDFEMB_LoadCMap_CNS Function: FPDFEMB_LoadCMap_Korean Function: FPDFEMB_LoadCMap_Japan Function: FPDFEMB_LoadCMap_Japan_Ext Make use of character encoding maps embedded with FPDFEMB

Comments: These functions add character encoding data to your application. Each call will increase the code size of your application. Total data size for all character sets is around 434K bytes.

void FPDFEMB_LoadCMap_GB_Ext ( )

Load full code table for GB.

See also:
FPDFEMB_LoadCMap_GB()
void FPDFEMB_LoadCMap_Japan ( )
void FPDFEMB_LoadCMap_Japan_Ext ( )

Load full code table for Japan.

See also:
FPDFEMB_LoadCMap_GB()
void FPDFEMB_LoadCMap_Korea ( )
void FPDFEMB_LoadJbig2Decoder ( )

Enable JBIG2 decoder.

void FPDFEMB_LoadJpeg2000Decoder ( )

Enable JPEG2000 decoder.

FPDFEMB_RESULT FPDFEMB_LoadPage ( FPDFEMB_DOCUMENT  document,
int  index,
FPDFEMB_PAGE page 
)

Function: FPDFEMB_LoadPage Load a page

Parameters:
[in]documentDocument handle
[in]indexPage index, starting from zero
[out]pageReceiving the loaded page handler
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_OpenFileFont ( struct FPDFEMB_FILE_ACCESS file,
FPDFEMB_FONT font_handle 
)

Function: FPDFEMB_OpenFileFont Load a font from a file

Comments: FPDFEMB only supports TrueType or Type1 font.

Parameters:
[in]filePointer to file access structure. This structure must be kept valid as long as the font is open.
[out]font_handleReceiving the font handle.
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_OpenStandardFont ( int  font_id,
FPDFEMB_FONT font_handle 
)

Function: FPDFEMB_OpenStandardFont Get ready to use a standard PDF font

Parameters:
[in]font_idID of font. See the above FPDFEMB_FONT_XXX definitions.
[out]font_handleReceiving the font handle.
Returns:
Error code, or FPDFERR_SUCCESS for success.
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 
)

Function: FPDFEMB_OutputGlyph Output a glyph onto a DIB device

Parameters:
[in]dibDIB handle, as the output device
[in]xDIB x-coordination for the glyph origin
[in]yDIB y-coordination for the glyph origin.
[in]font_handleHandle to the font
[in]font_sizeFont size in pixels
[in]matrixMatrix for the text output. Can be NULL.
[in]glyph_indexIndex of glyph to be output
[in]argbColor of the text, in 0xaarrggbb format.
Returns:
Error code, or FPDFERR_SUCCESS for success.
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 
)

Function: FPDFEMB_OutputText Output text string onto a DIB device.

Parameters:
[in]dibDIB handle, as the output device
[in]xDIB x-coordination for the origin point of the first character.
[in]yDIB y-coordination for the origin point of the first character.
[in]font_handleHandle to the font
[in]font_sizeFont size in pixels
[in]matrixMatrix for the text output. Can be NULL.
[in]textZero-terminated unicode text string
[in]argbColor of the text, in 0xaarrggbb format.
Returns:
Error code, or FPDFERR_SUCCESS for success.
FPDFEMB_RESULT FPDFEMB_PageLabelToPageNum ( FPDFEMB_DOCUMENT  document,
FPDFEMB_WCHAR pagelabel,
int *  pageNum 
)

Function: FPDFEMB_PageLabelToPageNum Get Page Number by Page Label

Parameters:
[in]documentHandle to the document
[in]pagelabelA zero-terminated unicode page label string to be found.
[out]pageNumReceiving the found page number
Returns:
Error code, or FPDFERR_SUCCESS for success. If not found, FPDFERR_NOTFOUND is returned.
void FPDFEMB_PageToDevicePoint ( FPDFEMB_PAGE  page,
int  start_x,
int  start_y,
int  size_x,
int  size_y,
int  rotate,
struct FPDFEMB_POINT point 
)

Function: FPDFEMB_PageToDevicePoint, FPDFEMB_PageToDeviceRect Convert the page coordinations of a point or a rectangle to device coordinations.

Comments:
For rectangle conversion, the result rectangle is always "normalized", meaning for device coordinations, left is always smaller than right, top is smaller than bottom.

Parameters:
[in]pageHandle to the page. Returned by FPDFEMB_LoadPage function.
[in]start_xLeft pixel position of the display area in the device coordination
[in]start_yTop pixel position of the display area in the device coordination
[in]size_xHorizontal size (in pixels) for displaying the page
[in]size_yVertical size (in pixels) for displaying the page
[in]rotatePage orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
[in,out]pointA point structure with page coordinations upon the call, also receiving the result device coordinations.
void FPDFEMB_PageToDeviceRect ( FPDFEMB_PAGE  page,
int  start_x,
int  start_y,
int  size_x,
int  size_y,
int  rotate,
struct FPDFEMB_RECT rect 
)
See also:
FPDFEMB_PageToDevicePoint()
Parameters:
[in]pageHandle to the page. Returned by FPDFEMB_LoadPage function.
[in]start_xLeft pixel position of the display area in the device coordination
[in]start_yTop pixel position of the display area in the device coordination
[in]size_xHorizontal size (in pixels) for displaying the page
[in]size_yVertical size (in pixels) for displaying the page
[in]rotatePage orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
[in,out]rectA rectangle structure with page coordinations upon the call, also receiving the result device coordinations.
FPDFEMB_RESULT FPDFEMB_QuickSearch ( FPDFEMB_DOCUMENT  document,
int  page_index,
const FPDFEMB_WCHAR pattern,
int  case_sensitive 
)

Function: FPDFEMB_QuickSearch Search a pattern in a page quickly, without the page to be parsed

Comments: This function does a rough and quick search in a page, before the page is loaded. The quick search will not generate an exact result saying where the pattern is found, and, it might be possible if a quick search result is "pattern found", and a real search for the same pattern, in the same page, will result in "not found".

However, if quick search doesn't find a pattern in a page, then we can be sure the pattern won't be found in this page when we do a real search. So, this function is very useful when we search in a multiple-page document, and we want to quickly skip those pages in which the pattern can't possibly be found.

Parameters:
[in]documentDocument handle returned by FPDFEMB_StartLoadDocument function
[in]page_indexZero-based index of the page
[in]patternA zero-terminated unicode string to be found.
[in]case_sensitiveNon-zero for case-sensitive searching, zero for case-insensitive
Returns:
FPDFERR_SUCCESS if pattern found, FPDFERR_NOTFOUND if pattern not found. Otherwise error code is returned.
void FPDFEMB_SetFileBufferSize ( int  size)

Function: FPDFEMB_SetFileBufferSize Set size of internal buffer used to read from source file.

Comments:
Currently FPDFEMB uses 512 bytes as default buffer size. The new buffer size takes effect next time you call FPDFEMB_StartLoadDocument.

Parameters:
[in]sizeNumber of bytes.
FPDFEMB_RESULT FPDFEMB_SetFontMapper ( struct FPDFEMB_FONT_MAPPER mapper)

Function: FPDFEMB_SetFontMapper Use a system font mapper (typically for Chinese/Japanese/Korean charsets)

Comments: This function is used with devices that come with one or more system fonts, and those fonts are in standard TT or T1 format.

Parameters:
[in]mapperPointer to FPDFEMB_FONT_MAPPER structure.
Returns:
Error code, or FPDFERR_SUCCESS for success
void FPDFEMB_SetGlyphProvider ( struct FPDFEMB_GLYPH_PROVIDER provider)

Function: FPDFEMB_SetGlyphProvider Make use of a glyph provider: generating glyph bitmap for non-Latin characters

Comments: FPDFEMB embeds some standard fonts for Latin characters and symbols, like Times, Courier and Helvetica (Arial). For non-Latin characters, however, FPDFEMB has to ask glyph provide for help.

If an embedded device carries fonts for non-Latin character sets, especially those for CJK markets, then the application can implement a glyph provider, allowing PDFs using non-embedded CJK fonts to be properly displayed.

Parameters:
[in]providerPointer to the glyph provider structure. This structure must stay valid throughout usage of FPDFEMB module.
void FPDFEMB_SetHalftoneLimit ( int  limit)

Function: FPDFEMB_SetHalftoneLimit Set pixel count limit for using halftone when display image

Comments:
By default, FPDFEMB displays all bitmaps using downsamping, which means if the image is shrinked onto screen, only part of pixels will be picked and displayed. This saves a lot of calculation, especially for big images with millions of pixels. However the display quality can be bad. In order to reach a balance between performance and quality, application can use this function to set a limit, if number of pixels in an image is more than this limit, then FPDFEMB will use downsampling for quick drawing, otherwise, if the image has less pixels, FPDFEMB will use halftoning for better quality.

Parameters:
[in]limitNumber of pixels for the limit
void FPDFEMB_SetLogProc ( void(*)(const char *msg)  proc)

Function: FPDFEMB_SetLogProc Set a logging procedure to output debugging messages from FPDFEMB

Parameters:
[in]procA callback function for output logging info
FPDFEMB_RESULT FPDFEMB_StartLoadDocument ( struct FPDFEMB_FILE_ACCESS file,
const char *  password,
FPDFEMB_DOCUMENT document,
struct FPDFEMB_PAUSE pause 
)

Function: FPDFEMB_StartLoadDocument Start loading a PDF document

Comments: Document loading is a progressive process. It might take a long time to load a document, especially when a file is corrupted, FPDFEMB will try to recover the document contents by scanning the whole file. If "pause" parameter is provided, this function may return FPDFERR_TOBECONTINUED any time during the document loading.

When FPDFERR_TOBECONTINUED is returned, the "document" parameter will still receive a valid document handle, however, no further operations can be performed on the document, except the "FPDFEMB_ContineLoadDocument" function call, which resume the document loading.

Parameters:
[in]filePointer to file access structure. This structure must be kept valid as long as the document is open.
[in]passwordPointer to a zero-terminated byte string, for the password. Or NULL for no password.
[out]documentReceiving the document handle
[in]pauseA callback mechanism allowing the document loading process to be paused before it's finished. This can be NULL if you don't want to pause.
Return values:
FPDFERR_SUCCESSdocument successfully loaded.
FPDFERR_TOBECONTINUEDThe document loading can't be finished now. See comments below.
FPDFERR_PASSWORDincorrect password.
FPDFERR_FORMATnot a PDF or corrupted PDF.
FPDFERR_FILEfile access error.
FPDFERR_MEMORYout of memory.
FPDFEMB_RESULT FPDFEMB_StartParse ( FPDFEMB_PAGE  page,
FPDFEMB_BOOL  text_only,
struct FPDFEMB_PAUSE pause 
)

Function: FPDFEMB_StartParse Start parsing a page, so it can get rendered or searched.

Comments:
Parsing is a progressive process. This function starts the parsing process, and may return before parsing is finished, if a pause structure is provided.

Application should call FPDFEMB_ContinueParse repeatedly to finish the parsing when return value is FPDFERR_TOBECONTINUED.

There can be only one parsing procedure active for a page, and if a page has already been parsed, you can't start a parsing again.

Parameters:
[in]pagePage handle
[in]text_onlyflag for parsing texts only (used for searching)
[in]pauseA structure that can pause the parsing process. Or NULL if you don't want to pause the process.
Return values:
FPDFERR_SUCCESSparsing successfully finished;
FPDFERR_TOBECONTINUEDparsing started successfully, but not finished;
FPDFERR_STATUSpage already parsed, or parsing already started. Other return value: error code.
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 
)

Function: FPDFEMB_StartQuickDraw Start drawing a quick preview of a page Comments: It's often useful to present user a quick preview of a page, right after the page is parsed. This preview renders only a limited set of easy features in the page, so it'll be rather quick to finish this process.

Parameters:
[in]dibDIB handle, as the rendering device
[in]pagePage handle. The page has to be parsed first.
[in]start_xLeft pixel position of the display area in the device coordination
[in]start_yTop pixel position of the display area in the device coordination
[in]size_xHorizontal size (in pixels) for displaying the page
[in]size_yVertical size (in pixels) for displaying the page
[in]rotatePage orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
[in]flagsReserved, must be zero.
[in]pausePointer to a structure that can pause the rendering process. Can be NULL if no pausing is needed.
Return values:
FPDFERR_SUCCESSquickdraw successfully finished;
FPDFERR_TOBECONTINUEDquickdraw started successfully, but not finished.
FPDFEMB_ContinueQuickDrawneeds to be called to finish the quickdraw;
FPDFERR_STATUSquickdraw already in progress, or page not parsed;
Otherreturn value: error code.
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 
)

Function: FPDFEMB_StartRender Start rendering of a page.

Comments:
Rendering is a progressive process. This function starts the rendering process, and may return before rendering is finished, if a pause structure is provided.

Application should call FPDFEMB_ContinueRender repeatedly to finish the rendering when return value is FPDFERR_TOBECONTINUED.

There can be only one rendering procedure for a page at any time. And rendering can be started over and over again for the same page. If a page rendering is already active, starting another one will cancel the previous rendering.

Rendering of a page doesn't draw the page background, therefore, you usually need to draw the background in the DIB yourself.

Parameters:
[out]dibDIB handle, as the rendering device
[in]pagePage handle. The page has to be parsed first.
[in]start_xLeft pixel position of the display area in the device coordination
[in]start_yTop pixel position of the display area in the device coordination
[in]size_xHorizontal size (in pixels) for displaying the page
[in]size_yVertical size (in pixels) for displaying the page
[in]rotatePage orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
[in]flags0 for normal display, or combination of flags defined above
[in]clipPointer to clip rectangle (in DIB device coordinations), or NULL if no clipping needed.
[in]pausePointer to a structure that can pause the rendering process. Can be NULL if no pausing is needed.
Return values:
FPDFERR_SUCCESSrendering successfully finished;
FPDFERR_TOBECONTINUEDrendering started successfully, but not finished;
Otherreturn value error code.
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 
)

Function: FPDFEMB_StretchDIB Stretch a source DIB into another destination DIB

Parameters:
[out]dest_dibThe destination DIB handle
[in]dest_leftLeft position in the destination DIB
[in]dest_topTop position in the destination DIB
[in]dest_widthDestination width, in pixels. Can be negative for horizontal flipping
[in]dest_heightDestination height, in pixels. Can be negative for vertical flipping
[in]clip_rectDestination clipping rectangle, or NULL for no clipping. The coordinations are measured in destination bitmap.
[in]src_dibSource DIB handle.
[in]interpolWhether we use interpolation to improve the result quality
Returns:
Error code, or FPDFERR_SUCCESS for success
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 
)

Function: FPDFEMB_TransformDIB Transform a source DIB into another destination DIB

Comments: All coordinations and distances are measured in destination bitmap system.

This function places the bottom-left pixel of the image at the destination origin, then the bottom sideline along the destination X vector, and left sideline along the destination Y vector.

Parameters:
[out]dest_dibThe destination DIB handle
[in]clip_rectDestination clipping rectangle, or NULL for no clipping. The coordinations are measured in destination bitmap.
[in]src_dibSource DIB handle.
[in]xX coordination of the dest origin
[in]yY coordination of the dest origin
[in]xxX distance of the dest X vector
[in]yxY distance of the dest X vector
[in]xyX distance of the dest Y vector
[in]yyY distance of the dest Y vector
[in]interpolWhether we use interpolation to improve the result quality
Returns:
Error code, or FPDFERR_SUCCESS for success
void FPDFEMB_UseExternalData ( const unsigned char *  data,
unsigned int  size 
)

Function: FPDFEMB_UseExternalCMaps Make use of external data for FPDFEMB

Comments: Some embedded system has limitation on program size, therefore we might not be able to embed a lot of data (like cmap data and embedded font data) into the FPDFEMB library. We introduced this function so device can choose to store those data outside of program, and make it available to FPDFEMB using this function. The data has to be provided by Foxit.

This function is only available in library specially built for using external data.

Parameters:
[in]dataPointer to the external data
[in]sizeNumber of bytes in the external data.
 All Data Structures Files Functions Variables Typedefs Defines