FPDFVIEW

Classes

struct  FPDF_FILEACCESS
struct  FPDF_GLYPHPROVIDER
 Define an interface for generating glyph bitmaps. This interface does not exist on desktop Windows system. But on alternative systems, including mobile system, this interface must be implemented in order to display non-embedded non-western fonts, like Chinese/Japanese/Korean characters. To make use of a glyph provider, call FPDF_SetGlyphProvider function. More...

Files

file  fpdfview.h
 

Header file for the view module - to render PDF documents and obtain basic PDF information.


Defines

#define DLLEXPORT
#define STDCALL
#define CDECL
#define FPDFERR_OUT_OF_MEMORY   1
#define FPDFERR_MISSING_FEATURE   2

Typedefs

typedef void * FPDF_MODULEMGR
typedef void * FPDF_DOCUMENT
typedef void * FPDF_PAGE
typedef void * FPDF_PAGEOBJECT
typedef void * FPDF_PATH
typedef void * FPDF_CLIPPATH
typedef void * FPDF_BITMAP
typedef void * FPDF_FONT
typedef void * FPDF_TEXTPAGE
typedef void * FPDF_SCHHANDLE
typedef void * FPDF_PAGELINK
typedef void * FPDF_HMODULE
typedef void * FPDF_DOCSCHHANDLE
typedef void * FPDF_BOOKMARK
typedef void * FPDF_DEST
typedef void * FPDF_ACTION
typedef void * FPDF_LINK
typedef int FPDF_BOOL
typedef int FPDF_ERROR
typedef unsigned long FPDF_DWORD
typedef unsigned short FPDF_WORD
typedef unsigned char FPDF_BYTE
typedef unsigned short FPDF_WCHAR
typedef unsigned char const * FPDF_LPCBYTE
typedef const char * FPDF_BYTESTRING
typedef const unsigned short * FPDF_WIDESTRING
typedef const char * FPDF_STRING
typedef void(* FPDF_ENUMPAGESIZEPROC )(int page_index, double width, double height)
typedef void(* FPDF_ErrorHandler )(int code, FPDF_BYTESTRING msg)

Functions

DLLEXPORT void STDCALL FPDF_InitLibrary (void *hInstance)
DLLEXPORT FPDF_MODULEMGR STDCALL FPDF_GetModuleMgr ()
DLLEXPORT void STDCALL FPDF_DestroyLibrary ()
DLLEXPORT void STDCALL FPDF_UnlockDLL (FPDF_BYTESTRING license_id, FPDF_BYTESTRING unlock_code)
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument (FPDF_STRING file_path, FPDF_BYTESTRING password)
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument (const void *data_buf, int size, FPDF_BYTESTRING password)
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument (FPDF_FILEACCESS *pFileAccess, FPDF_BYTESTRING password)
DLLEXPORT unsigned long STDCALL FPDF_GetLastError ()
DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions (FPDF_DOCUMENT document)
DLLEXPORT int STDCALL FPDF_GetPageCount (FPDF_DOCUMENT document)
DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage (FPDF_DOCUMENT document, int page_index)
DLLEXPORT double STDCALL FPDF_GetPageWidth (FPDF_PAGE page)
DLLEXPORT double STDCALL FPDF_GetPageHeight (FPDF_PAGE page)
DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex (FPDF_DOCUMENT document, int page_index, double *width, double *height)
DLLEXPORT void STDCALL FPDF_EnumPageSize (FPDF_DOCUMENT document, FPDF_ENUMPAGESIZEPROC callback)
DLLEXPORT void STDCALL FPDF_RenderPageBitmap (FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags)
DLLEXPORT void STDCALL FPDF_QuickDrawPage (FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags)
DLLEXPORT void STDCALL FPDF_ClosePage (FPDF_PAGE page)
DLLEXPORT void STDCALL FPDF_CloseDocument (FPDF_DOCUMENT document)
DLLEXPORT void STDCALL FPDF_DeviceToPage (FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int device_x, int device_y, double *page_x, double *page_y)
DLLEXPORT void STDCALL FPDF_PageToDevice (FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, double page_x, double page_y, int *device_x, int *device_y)
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create (int width, int height, int alpha)
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx (int width, int height, int format, void *first_scan, int stride)
DLLEXPORT void STDCALL FPDFBitmap_FillRect (FPDF_BITMAP bitmap, int left, int top, int width, int height, int red, int green, int blue, int alpha)
DLLEXPORT void *STDCALL FPDFBitmap_GetBuffer (FPDF_BITMAP bitmap)
DLLEXPORT int STDCALL FPDFBitmap_GetWidth (FPDF_BITMAP bitmap)
DLLEXPORT int STDCALL FPDFBitmap_GetHeight (FPDF_BITMAP bitmap)
DLLEXPORT int STDCALL FPDFBitmap_GetStride (FPDF_BITMAP bitmap)
DLLEXPORT void STDCALL FPDFBitmap_Destroy (FPDF_BITMAP bitmap)
DLLEXPORT void *STDCALL FPDF_AllocMemory (unsigned long size)
DLLEXPORT void STDCALL FPDF_FreeMemory (void *p)
DLLEXPORT void STDCALL FPDF_SetErrorHandler (FPDF_ErrorHandler func)
DLLEXPORT void STDCALL FPDF_SetModulePath (FPDF_STRING module_name, FPDF_STRING folder_name)
DLLEXPORT void STDCALL FPDF_SetGlyphProvider (FPDF_GLYPHPROVIDER *pProvider)
DLLEXPORT int STDCALL FPDF_SetSystemFontFile (FPDF_BYTESTRING file_path)
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetFirstChild (FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark)
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetNextSibling (FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark)
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find (FPDF_DOCUMENT document, FPDF_WIDESTRING title)
DLLEXPORT unsigned long STDCALL FPDFBookmark_GetColorRef (FPDF_BOOKMARK bookmark)
DLLEXPORT unsigned long STDCALL FPDFBookmark_GetFontStyle (FPDF_BOOKMARK bookmark)
DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle (FPDF_BOOKMARK bookmark, void *buffer, unsigned long buflen)
DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction (FPDF_BOOKMARK bookmark)
DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest (FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark)
DLLEXPORT int STDCALL FPDFBookmark_GetPageFirstLine (FPDF_PAGE page, void *buffer, int buflen)
DLLEXPORT unsigned long STDCALL FPDFAction_GetType (FPDF_ACTION action)
DLLEXPORT unsigned long STDCALL FPDFAction_GetFilePath (FPDF_ACTION action, void *buffer, unsigned long buflen)
DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest (FPDF_DOCUMENT document, FPDF_ACTION action)
DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath (FPDF_DOCUMENT document, FPDF_ACTION action, void *buffer, unsigned long buflen)
DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex (FPDF_DOCUMENT document, FPDF_DEST dest)
DLLEXPORT unsigned long STDCALL FPDFDest_GetZoomMode (FPDF_DEST dest)
DLLEXPORT double STDCALL FPDFDest_GetZoomParam (FPDF_DEST dest, int param)
DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint (FPDF_PAGE page, double x, double y)
DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest (FPDF_DOCUMENT document, FPDF_LINK link)
DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction (FPDF_LINK link)
DLLEXPORT unsigned long STDCALL FPDF_GetMetaText (FPDF_DOCUMENT doc, FPDF_BYTESTRING tag, void *buffer, unsigned long buflen)
 _WIN32_WCE

Last error code

#define FPDF_ERR_SUCCESS   0
 No error.
#define FPDF_ERR_UNKNOWN   1
 Unknown error.
#define FPDF_ERR_FILE   2
 Unknown error.
#define FPDF_ERR_FORMAT   3
 File not found or could not be opened.
#define FPDF_ERR_PASSWORD   4
 Password required or incorrect password.
#define FPDF_ERR_SECURITY   5
 Unsupported security scheme.
#define FPDF_ERR_PAGE   6
 Page not found or content error.

The result of the process which check linearized to be rendered.

#define FPDF_ANNOT   0x01
#define FPDF_LCD_TEXT   0x02
#define FPDF_NO_NATIVETEXT   0x04
#define FPDF_GRAYSCALE   0x08
#define FPDF_DEBUG_INFO   0x80
#define FPDF_NO_CATCH   0x100

More DIB formats

#define FPDFBitmap_Gray   1
#define FPDFBitmap_BGR   2
#define FPDFBitmap_BGRx   3
#define FPDFBitmap_BGRA   4

Bookmark font styles

#define PDFBOOKMARK_NORMAL   0
 NORMAL.
#define PDFBOOKMARK_ITALIC   1
 ITALIC.
#define PDFBOOKMARK_BOLD   2
 BOLD.
#define PDFBOOKMARK_BOLDITALIC   3
 BOLD ITALIC.

Action styles

#define PDFACTION_UNSUPPORTED   0
 Unsupported action type.
#define PDFACTION_GOTO   1
 Go to a destination within current document.
#define PDFACTION_REMOTEGOTO   2
 Go to a destination within another document.
#define PDFACTION_URI   3
 Universal Resource Identifier, including web pages and other Internet based resources.
#define PDFACTION_LAUNCH   4
 Launch an application or open a file.

Zoom modes

#define PDFZOOM_XYZ   1
 Zoom level with specified offset.
#define PDFZOOM_FITPAGE   2
 Fit both the width and height of the page (whichever smaller).
#define PDFZOOM_FITHORZ   3
 Fit the page width.
#define PDFZOOM_FITVERT   4
 Fit the page height.
#define PDFZOOM_FITRECT   5
 Fit a specific rectangle area within the window.
#define PDFZOOM_FITBBOX   6
 Fit the bounding box entirely within the window both horizontally and vertically.
#define PDFZOOM_FITBHORZ   7
 The contents of the page magnified just enough to fit the entire width of its bounding box within the window.
#define PDFZOOM_FITBVERT   8
 The contents of the page magnified just enough to fit the entire height of its bounding box within the window.

Detailed Description

Header file for the view module


Define Documentation

#define FPDF_ANNOT   0x01

Set if annotations are to be rendered.

#define FPDF_DEBUG_INFO   0x80

Set if you want to get some debug info. Please discuss with Foxit first if you need to collect debug info.

#define FPDF_GRAYSCALE   0x08

Grayscale output.

#define FPDF_LCD_TEXT   0x02

Set if using text rendering optimized for LCD display.

#define FPDF_NO_CATCH   0x100

Set if you don't want to catch exception.

#define FPDF_NO_NATIVETEXT   0x04

Don't use the native text output available on some platforms Applicable to desktop Windows systems only.

#define FPDFBitmap_BGR   2

3 bytes per pixel, byte order: blue, green, red.

#define FPDFBitmap_BGRA   4

4 bytes per pixel, byte order: blue, green, red, alpha.

#define FPDFBitmap_BGRx   3

4 bytes per pixel, byte order: blue, green, red, unused.

#define FPDFBitmap_Gray   1

Gray scale bitmap, one byte per pixel.

#define FPDFERR_MISSING_FEATURE   2

Missing PDF feature. The error handler can safely continue with other rendering.

#define FPDFERR_OUT_OF_MEMORY   1

Out of memory. The error handler should quit the application, or use long jump to get out of current rendering.


Typedef Documentation

typedef int FPDF_BOOL

Basic data types

typedef const char* FPDF_BYTESTRING

FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE encoded), and platform dependent string

typedef void* FPDF_DOCUMENT

PDF types

typedef void(* FPDF_ENUMPAGESIZEPROC)(int page_index, double width, double height)

Declares of a pointer type to the callback function for the FPDF_EnumPageSize method. page_index - Page index, zero for the first page. width - The page width. height - The page height.

Return values:
None.
typedef void* FPDF_MODULEMGR

Data types

typedef const char* FPDF_STRING

For Windows programmers: for most case it's OK to treat FPDF_WIDESTRING as Windows unicode string, however, special care needs to be taken if you expect to process Unicode larger than 0xffff. For Linux/Unix programmers: most compiler/library environment uses 4 bytes for a Unicode character, you have to convert between FPDF_WIDESTRING and system wide string by yourself.

typedef unsigned short FPDF_WCHAR

String types

typedef const unsigned short* FPDF_WIDESTRING

Foxit PDF SDK always use UTF-16LE encoding wide string, each character use 2 bytes (except subrogation), with low byte first.


Function Documentation

DLLEXPORT void* STDCALL FPDF_AllocMemory ( unsigned long  size)

Allocate memory block in FPDFSDK. This memory can be freed by FPDF_FreeMemory function.

Parameters:
[in]size- Byte size of requested memory block. Can not be zero.
Note:
Some FPDFSDK interface may require application to allocate memory for internal use of FPDFSDK. In this case application must call this function to allocate memory, don't use malloc() or other memory allocator. If an error handler installed and exception/long jump is used in the out of memory handling, this function might never return if no memory available.
Return values:
Theallocated pointer. NULL if memory not available.
DLLEXPORT void STDCALL FPDF_CloseDocument ( FPDF_DOCUMENT  document)

Close a loaded PDF document.

Parameters:
[in]document- Handle to the loaded document.
Return values:
None.
DLLEXPORT void STDCALL FPDF_ClosePage ( FPDF_PAGE  page)

Close a loaded PDF page.

Parameters:
[in]page- Handle to the loaded page.
Return values:
None.
DLLEXPORT void STDCALL FPDF_DestroyLibrary ( )

Release all resources allocated by the FPDFSDK library.

Note:
You can call this function to release all memory blocks allocated by the library. After this function is called, you should not call any PDF processing functions.
Return values:
None.
DLLEXPORT void STDCALL FPDF_DeviceToPage ( FPDF_PAGE  page,
int  start_x,
int  start_y,
int  size_x,
int  size_y,
int  rotate,
int  device_x,
int  device_y,
double *  page_x,
double *  page_y 
)

Convert the screen coordinate of a point to page coordinate.

Parameters:
[in]page- Handle to the page. Returned by FPDF_LoadPage function.
[in]start_x- Left pixel position of the display area in the device coordinate.
[in]start_y- Top pixel position of the display area in the device coordinate.
[in]size_x- Horizontal size (in pixels) for displaying the page.
[in]size_y- Vertical size (in pixels) for displaying the page.
[in]rotate- Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
[in]device_x- X value in device coordinate, for the point to be converted.
[in]device_y- Y value in device coordinate, for the point to be converted.
[in]page_x- A Pointer to a double receiving the converted X value in page coordinate.
[in]page_y- A Pointer to a double receiving the converted Y value in page coordinate.
Note:
The page coordinate 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. NOTE: this coordinate system can be altered when you zoom, scroll, or rotate a page, however, a point on the page should always have the same coordinate values in the page coordinate system.

The device coordinate system is device dependent. For screen device, its origin is at left-top corner of the window. However this origin can be altered by Windows coordinate transformation utilities. You must make sure the start_x, start_y, size_x, size_y and rotate parameters have exactly same values as you used in FPDF_RenderPage() function call.

Return values:
None.
DLLEXPORT void STDCALL FPDF_EnumPageSize ( FPDF_DOCUMENT  document,
FPDF_ENUMPAGESIZEPROC  callback 
)

Enumerating all pages within the document.

Parameters:
[in]document- Handle to document. Returned by FPDF_LoadDocument function.
[in]callback- A pointer to a callback function.
Return values:
None.
DLLEXPORT void STDCALL FPDF_FreeMemory ( void *  p)

Free a memory area allocated by Foxit SDK.

Parameters:
[in]p- The pointer. Should not be NULL.
Return values:
None.
Note:
In case FPDFSDK allocated some memory for user application, the user application must free it to avoid memory leakage. And the application must call FPDF_FreeMemory function to do that. Do NOT use c/c++ memory free() function or other similar functions.
DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions ( FPDF_DOCUMENT  document)

Get file permission flags of the document.

Parameters:
[in]document- Handle to document. Returned by FPDF_LoadDocument function.
Return values:
A32-bit integer indicating permission flags. Please refer to PDF Reference for detailed description. If the document is not protected, 0xffffffff will be returned.
DLLEXPORT unsigned long STDCALL FPDF_GetLastError ( )

Get last error code when an SDK function failed.

Note:
If the previous SDK call succeeded, the return value of this function is not defined.
Return values:
A32-bit integer indicating error codes (defined above).
DLLEXPORT unsigned long STDCALL FPDF_GetMetaText ( FPDF_DOCUMENT  doc,
FPDF_BYTESTRING  tag,
void *  buffer,
unsigned long  buflen 
)

_WIN32_WCE

Get a text from meta data of the document. Result is encoded in UTF-16LE.

Parameters:
[in]doc- Handle to a document
[in]tag- The tag for the meta data. Currently, It can be "Title", "Author", "Subject", "Keywords", "Creator", "Producer", "CreationDate", or "ModDate". For detailed explanation of these tags and their respective values, please refer to PDF Reference 1.6, section 10.2.1, "Document Information Dictionary".
[out]buffer- A buffer for output the title. Can be NULL.
[in]buflen- The length of the buffer, number of bytes. Can be 0.
Note:
No matter on what platform, the title is always output in UTF-16LE encoding, which means the buffer can be regarded as an array of WORD (on Intel and compatible CPUs), each WORD represent the Unicode of a character (some special Unicode may take 2 WORDs). The string is followed by two bytes of zero indicating end of the string.

The return value always indicated number of bytes required for the buffer, even when there is no buffer specified, or the buffer size is less then required. In this case, the buffer will not be modified.

Return values:
Numberof bytes the title consumes, including trailing zeros. _FPDFVIEW_H_
DLLEXPORT FPDF_MODULEMGR STDCALL FPDF_GetModuleMgr ( )

Get the module of this DLL.

Return values:
FPDF_MODULEMGR- The handle of this module.
DLLEXPORT int STDCALL FPDF_GetPageCount ( FPDF_DOCUMENT  document)

Get total number of pages in a document.

Parameters:
[in]document- Handle to document. Returned by FPDF_LoadDocument function.
Return values:
Totalnumber of pages in the document.
DLLEXPORT double STDCALL FPDF_GetPageHeight ( FPDF_PAGE  page)

Get page height.

Parameters:
[in]page- Handle to the page. Returned by FPDF_LoadPage function.
Return values:
Pageheight (excluding non-displayable area) measured in points. One point is 1/72 inch (around 0.3528 mm)
DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex ( FPDF_DOCUMENT  document,
int  page_index,
double *  width,
double *  height 
)

Get the size of a page by index.

Parameters:
[in]document- Handle to document. Returned by FPDF_LoadDocument function.
[in]page_index- Page index, zero for the first page.
[in]width- Pointer to a double receiving the page width (in points).
[in]height- Pointer to a double receiving the page height (in points).
Return values:
Non-zerofor success. 0 for error (document or page not found).
DLLEXPORT double STDCALL FPDF_GetPageWidth ( FPDF_PAGE  page)

Get page width.

Parameters:
[in]page- Handle to the page. Returned by FPDF_LoadPage function.
Return values:
Pagewidth (excluding non-displayable area) measured in points. One point is 1/72 inch (around 0.3528 mm).
DLLEXPORT void STDCALL FPDF_InitLibrary ( void *  hInstance)

Initialize the FPDFSDK library

Parameters:
[in]hInstance- For WIN32 system only: the instance of the executable or DLL module.
Note:
You have to call this function before you can call any PDF processing functions.
Return values:
None.
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument ( FPDF_FILEACCESS pFileAccess,
FPDF_BYTESTRING  password 
)

Load PDF document from a custom access descriptor.

Parameters:
[in]pFileAccess- A structure for access the file.
[in]password- Optional password for decrypting the PDF file.
Note:
The application should maintain the file resources being valid until the PDF document close. Loaded document can be closed by FPDF_CloseDocument.
Return values:
Ahandle to the loaded document. If failed, NULL is returned.
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument ( FPDF_STRING  file_path,
FPDF_BYTESTRING  password 
)

Open and load a PDF document.

Parameters:
[in]file_path- Path to the PDF file (including extension).
[in]password- A string used as the password for PDF file. If no password needed, empty or NULL can be used.
Note:
Loaded document can be closed by FPDF_CloseDocument. If this function fails, you can use FPDF_GetLastError() to retrieve the reason why it fails.
Return values:
Ahandle to the loaded document. If failed, NULL is returned.
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument ( const void *  data_buf,
int  size,
FPDF_BYTESTRING  password 
)

Open and load a PDF document from memory.

Parameters:
[in]data_buf- Pointer to a buffer containing the PDF document.
[in]size- Number of bytes in the PDF document.
[in]password- A string used as the password for PDF file. If no password needed, empty or NULL can be used.
Note:
The memory buffer must remain valid when the document is open. Loaded document can be closed by FPDF_CloseDocument. If this function fails, you can use FPDF_GetLastError() to retrieve the reason why it fails.
Return values:
Ahandle to the loaded document. If failed, NULL is returned.
DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage ( FPDF_DOCUMENT  document,
int  page_index 
)

Load a page inside a document.

Parameters:
[in]document- Handle to document. Returned by FPDF_LoadDocument function.
[in]page_index- Index number of the page. 0 for the first page.
Note:
Loaded page can be rendered to devices using FPDF_RenderPage function. Loaded page can be closed by FPDF_ClosePage.
Return values:
Ahandle to the loaded page. If failed, NULL is returned.
DLLEXPORT void STDCALL FPDF_PageToDevice ( FPDF_PAGE  page,
int  start_x,
int  start_y,
int  size_x,
int  size_y,
int  rotate,
double  page_x,
double  page_y,
int *  device_x,
int *  device_y 
)

Convert the page coordinate of a point to screen coordinate.

Parameters:
[in]page- Handle to the page. Returned by FPDF_LoadPage function.
[in]start_x- Left pixel position of the display area in the device coordinate.
[in]start_y- Top pixel position of the display area in the device coordinate.
[in]size_x- Horizontal size (in pixels) for displaying the page.
[in]size_y- Vertical size (in pixels) for displaying the page.
[in]rotate- Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
[in]page_x- X value in page coordinate, for the point to be converted.
[in]page_y- Y value in page coordinate, for the point to be converted.
[in]device_x- A pointer to an integer receiving the result X value in device coordinate.
[in]device_y- A pointer to an integer receiving the result Y value in device coordinate.
Note:
See comments of FPDF_DeviceToPage() function.
Return values:
None.
DLLEXPORT void STDCALL FPDF_QuickDrawPage ( FPDF_BITMAP  bitmap,
FPDF_PAGE  page,
int  start_x,
int  start_y,
int  size_x,
int  size_y,
int  rotate,
int  flags 
)

Draw a thumbnail of a page into a bitmap.

Parameters:
[in]bitmap- Handle to the device independent bitmap (as the output buffer). Bitmap handle can be created by FPDFBitmap_Create function.
[in]page- Handle to the page. Returned by FPDF_LoadPage function.
[in]start_x- Left pixel position of the display area in the device coordinate.
[in]start_y- Top pixel position of the display area in the device coordinate.
[in]size_x- Horizontal size (in pixels) for displaying the page.
[in]size_y- Vertical size (in pixels) for displaying the page.
[in]rotate- Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
[in]flags- Currently must be zero.
Note:
This functions draws a very low-resolution thumbnail of a page, sometimes with inaccurate shape or position. The result thumbnail is meant for a very rough preview of the page contents, just giving user some idea about how the page looks like. The thumbnail is often useful in multi-threaded or progressive environment, the application can first display the low-resolution thumbnail, start to respond to user input, and a higher resolution thumbnail can be generated by FPDF_RenderPageBitmap function.
Return values:
None.
DLLEXPORT void STDCALL FPDF_RenderPageBitmap ( FPDF_BITMAP  bitmap,
FPDF_PAGE  page,
int  start_x,
int  start_y,
int  size_x,
int  size_y,
int  rotate,
int  flags 
)

Render contents in a page to a device independent bitmap

Parameters:
[in]bitmap- Handle to the device independent bitmap (as the output buffer). Bitmap handle can be created by FPDFBitmap_Create function.
[in]page- Handle to the page. Returned by FPDF_LoadPage function.
[in]start_x- Left pixel position of the display area in the bitmap coordinate.
[in]start_y- Top pixel position of the display area in the bitmap coordinate.
[in]size_x- Horizontal size (in pixels) for displaying the page.
[in]size_y- Vertical size (in pixels) for displaying the page.
[in]rotate- Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
[in]flags- 0 for normal display, or combination of flags defined above.
Return values:
None.
DLLEXPORT void STDCALL FPDF_SetErrorHandler ( FPDF_ErrorHandler  func)

Set a call back function when FPDFSDK has some error to report.

Parameters:
[in]func- Pointer to the error handler function.
Note:
Currently only two error codes are defined (see above).
Return values:
None.
DLLEXPORT void STDCALL FPDF_SetGlyphProvider ( FPDF_GLYPHPROVIDER pProvider)

Make use of a custom glyph bitmap provider. Not available on Desktop Windows system.

Parameters:
[in]pProvider- Pointer to a provider structure. This structure must be available all the time (better put it in static data). And all member interfaces of this structure should be properly set and implemented.
Return values:
None.
DLLEXPORT void STDCALL FPDF_SetModulePath ( FPDF_STRING  module_name,
FPDF_STRING  folder_name 
)

Set the folder path for module files (like the FPDFCJK.BIN).

Parameters:
[in]module_name- Name of the module. Currently please use NULL (0) only.
[in]folder_name- Name of the folder. For example: "C:\\program files\\FPDFSDK".
Return values:
None.
DLLEXPORT int STDCALL FPDF_SetSystemFontFile ( FPDF_BYTESTRING  file_path)

Make use of a system font. The font file must be in TrueType or Type1 format and must be encoded in a standard encoding system. Available for embedded Linux system only.

Parameters:
[in]file_path- The full path of the font file.
Return values:
Non-zerofor success. Zero for error.
DLLEXPORT void STDCALL FPDF_UnlockDLL ( FPDF_BYTESTRING  license_id,
FPDF_BYTESTRING  unlock_code 
)

Unlock the DLL using license key info received from Foxit.

Parameters:
[in]license_id- A string received from Foxit identifying the SDK license.
[in]unlock_code- A string received from Foxit for unlocking the DLL.
Note:
For SDK evaluators, this function call is not required, then all rendered pages will come with an evaluation mark. For purchased SDK customers, this should be the first function called before any other functions to be called.
Return values:
None.
DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest ( FPDF_DOCUMENT  document,
FPDF_ACTION  action 
)

Get destination of an action.

Parameters:
[in]document- Handle to the document..
[in]action- Handle to the action. It must be a GOTO or REMOTEGOTO action.
Note:
In case of remote goto action, the application should first use FPDFAction_GetFilePath to get file path, then load that particular document, and use its document handle to call this function.
Return values:
Handleto the destination data.
DLLEXPORT unsigned long STDCALL FPDFAction_GetFilePath ( FPDF_ACTION  action,
void *  buffer,
unsigned long  buflen 
)

Get file path of a remote goto action.

Parameters:
[in]action- Handle to the action. Must be a RMEOTEGOTO or LAUNCH action.
[out]buffer- A buffer for output the path string. Can be NULL.
[in]buflen- The length of the buffer, number of bytes. Can be 0.
Note:
The file path is output in local encoding. The return value always indicated number of bytes required for the buffer, even when there is no buffer specified, or the buffer size is less then required. In this case, the buffer will not be modified.
Return values:
Numberof bytes the file path consumes, including trailing zero.
DLLEXPORT unsigned long STDCALL FPDFAction_GetType ( FPDF_ACTION  action)

Get type of an action.

Parameters:
[in]action- Handle to the action.
Return values:
Atype number as the action styles.
DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath ( FPDF_DOCUMENT  document,
FPDF_ACTION  action,
void *  buffer,
unsigned long  buflen 
)

Get URI path of a URI action.

Parameters:
[in]document- Handle to the document.
[in]action- Handle to the action. Must be a URI action.
[out]buffer- A buffer for output the path string. Can be NULL.
[in]buflen- The length of the buffer, number of bytes. Can be 0.
Note:
The URI path is always encoded in 7-bit ASCII. The return value always indicated number of bytes required for the buffer, even when there is no buffer specified, or the buffer size is less then required. In this case, the buffer will not be modified.
Return values:
Numberof bytes the URI path consumes, including trailing zeros.
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create ( int  width,
int  height,
int  alpha 
)

Create a Foxit Device Independent Bitmap (FXDIB).

Parameters:
[in]width- Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
[in]height- Number of pixels in a vertical line of the bitmap. Must be greater than 0.
[in]alpha- A flag indicating whether alpha channel is used. Non-zero for using alpha, zero for not using.
Note:
An FXDIB always use 4 byte per pixel. The first byte of a pixel is always double word aligned. Each pixel contains red (R), green (G), blue (B) and optionally alpha (A) values. The byte order is BGRx (the last byte unused if no alpha channel) or BGRA.

The pixels in a horizontal line (also called scan line) are stored side by side, with left most pixel stored first (with lower memory address). Each scan line uses width*4 bytes.

Scan lines are stored one after another, with top most scan line stored first. There is no gap between adjacent scan lines.

This function allocates enough memory for holding all pixels in the bitmap, but it doesn't initialize the buffer. Applications can use FPDFBitmap_FillRect to fill the bitmap using any color.

Return values:
Thecreated bitmap handle, or NULL if parameter error or out of memory.
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx ( int  width,
int  height,
int  format,
void *  first_scan,
int  stride 
)

Create a Foxit Device Independent Bitmap (FXDIB)

Parameters:
[in]width- Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
[in]height- Number of pixels in a vertical line of the bitmap. Must be greater than 0.
[in]format- A number indicating for bitmap format, as defined above.
[in]first_scan- A pointer to the first byte of first scan line, for external buffer only. If this parameter is NULL, then the SDK will create its own buffer.
[in]stride- Number of bytes for each scan line, for external buffer only..
Note:
Similar to FPDFBitmap_Create function, with more formats and external buffer supported. Bitmap created by this function can be used in any place that a FPDF_BITMAP handle is required.

If external scanline buffer is used, then the application should destroy the buffer by itself. FPDFBitmap_Destroy function will not destroy the buffer.

Return values:
Thecreated bitmap handle, or NULL if parameter error or out of memory.
DLLEXPORT void STDCALL FPDFBitmap_Destroy ( FPDF_BITMAP  bitmap)

Destroy an FXDIB and release all related buffers.

Parameters:
[in]bitmap- Handle to the bitmap. Returned by FPDFBitmap_Create function.
Note:
This function will not destroy any external buffer.
Return values:
None.
DLLEXPORT void STDCALL FPDFBitmap_FillRect ( FPDF_BITMAP  bitmap,
int  left,
int  top,
int  width,
int  height,
int  red,
int  green,
int  blue,
int  alpha 
)

Fill a rectangle area in an FXDIB.

Parameters:
[in]bitmap- The handle to the bitmap. Returned by FPDFBitmap_Create function.
[in]left- The left side position. Starting from 0 at the left-most pixel.
[in]top- The top side position. Starting from 0 at the top-most scan line.
[in]width- Number of pixels to be filled in each scan line.
[in]height- Number of scan lines to be filled.
[in]red- A number from 0 to 255, identifying the red intensity.
[in]green- A number from 0 to 255, identifying the green intensity.
[in]blue- A number from 0 to 255, identifying the blue intensity.
[in]alpha- (Only if the alpha channeled is used when bitmap created) A number from 0 to 255, identifying the alpha value.
Note:
This function set the color and (optionally) alpha value in specified region of the bitmap. NOTE: If alpha channel is used, this function does NOT composite the background with the source color, instead the background will be replaced by the source color and alpha. If alpha channel is not used, the "alpha" parameter is ignored.
Return values:
None.
DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer ( FPDF_BITMAP  bitmap)

Get data buffer of an FXDIB

Parameters:
[in]bitmap- Handle to the bitmap. Returned by FPDFBitmap_Create function.
Note:
Applications can use this function to get the bitmap buffer pointer, then manipulate any color and/or alpha values for any pixels in the bitmap.
Return values:
Thepointer to the first byte of the bitmap buffer.
DLLEXPORT int STDCALL FPDFBitmap_GetHeight ( FPDF_BITMAP  bitmap)

Get height of an FXDIB.

Parameters:
[in]bitmap- Handle to the bitmap. Returned by FPDFBitmap_Create function.
Return values:
Thenumber of pixels in a vertical line of the bitmap.
DLLEXPORT int STDCALL FPDFBitmap_GetStride ( FPDF_BITMAP  bitmap)

Get number of bytes for each scan line in the bitmap buffer.

Parameters:
[in]bitmap- Handle to the bitmap. Returned by FPDFBitmap_Create function.
Return values:
Thenumber of bytes for each scan line in the bitmap buffer.
DLLEXPORT int STDCALL FPDFBitmap_GetWidth ( FPDF_BITMAP  bitmap)

Get width of an FXDIB.

Parameters:
[in]bitmap- Handle to the bitmap. Returned by FPDFBitmap_Create function.
Return values:
Thenumber of pixels in a horizontal line of the bitmap.
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find ( FPDF_DOCUMENT  document,
FPDF_WIDESTRING  title 
)

Find a bookmark in the document, using the bookmark title.

Parameters:
[in]document- Handle to the document. Returned by FPDF_LoadDocument or FPDF_LoadMemDocument.
[in]title- The UTF-16LE encoded Unicode string for the bookmark title to be searched. Can't be NULL.
Note:
It always returns the first found bookmark if more than one bookmarks have the same title.
Return values:
Handleto the found bookmark item. NULL if the title can't be found.
DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction ( FPDF_BOOKMARK  bookmark)

Get the action associated with a bookmark item.

Parameters:
[in]bookmark- Handle to the bookmark.
Return values:
Handleto the action data. NULL if no action is associated with this bookmark. In this case, the application should try FPDFBookmark_GetDest.
DLLEXPORT unsigned long STDCALL FPDFBookmark_GetColorRef ( FPDF_BOOKMARK  bookmark)

Get designated color of a bookmark item.

Parameters:
[in]bookmark- Handle to the bookmark.
Return values:
ACOLORREF value (0x00ggbbrr) for the bookmark item.
DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest ( FPDF_DOCUMENT  document,
FPDF_BOOKMARK  bookmark 
)

Get the destination associated with a bookmark item.

Parameters:
[in]document- Handle to the document.
[in]bookmark- Handle to the bookmark.
Return values:
Handleto the destination data. NULL if no destination is associated with this bookmark.
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetFirstChild ( FPDF_DOCUMENT  document,
FPDF_BOOKMARK  bookmark 
)

Get first child of a bookmark item, or first top level bookmark item.

Parameters:
[in]document- Handle to the document. Returned by FPDF_LoadDocument or FPDF_LoadMemDocument.
[in]bookmark- Handle to the current bookmark. Can be NULL if you want to get the first top level item.
Return values:
Handleto the first child or top level bookmark item. NULL if no child or top level bookmark found.
DLLEXPORT unsigned long STDCALL FPDFBookmark_GetFontStyle ( FPDF_BOOKMARK  bookmark)

Get designated font style for a bookmark item.

Parameters:
[in]bookmark- Handle to the bookmark.
Return values:
Anumber indicating the font style, as the bookmark font styles.
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetNextSibling ( FPDF_DOCUMENT  document,
FPDF_BOOKMARK  bookmark 
)

Get next bookmark item on the same level.

Parameters:
[in]document- Handle to the document. Returned by FPDF_LoadDocument or FPDF_LoadMemDocument.
[in]bookmark- Handle to the current bookmark. Cannot be NULL.
Return values:
Handleto the next bookmark item on the same level. NULL if this is the last bookmark on this level.
DLLEXPORT int STDCALL FPDFBookmark_GetPageFirstLine ( FPDF_PAGE  page,
void *  buffer,
int  buflen 
)

Get first text line of the page, which can be used for alternative bookmark, if no bookmark is available.

Parameters:
[in]page- The page handle.
[out]buffer- A buffer for output the text. Can be NULL.
[in]buflen- The length of the buffer, number of bytes. Can be 0.
Note:
No matter on what platform, the title is always output in UTF-16LE encoding, which means the buffer can be regarded as an array of WORD (on Intel and compatible CPUs), each WORD represent the Unicode of a character (some special Unicode may take 2 WORDs). The string is followed by two bytes of zero indicating end of the string.

The return value always indicated number of bytes required for the buffer, even when there is no buffer specified, or the buffer size is less then required. In this case, the buffer will not be modified.

TEMPORARY FUNCTION WILL BE OBSOLETE SOON!

Return values:
Numberof bytes the text line consumes, including trailing zeros.
DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle ( FPDF_BOOKMARK  bookmark,
void *  buffer,
unsigned long  buflen 
)

Get title of a bookmark.

Parameters:
[in]bookmark- Handle to the bookmark.
[out]buffer- A buffer for output the title. Can be NULL.
[in]buflen- The length of the buffer, number of bytes. Can be 0..
Note:
No matter on what platform, the title is always output in UTF-16LE encoding, which means the buffer can be regarded as an array of WORD (on Intel and compatible CPUs), each WORD represent the Unicode of a character (some special Unicode may take 2 WORDs). The string is followed by two bytes of zero indicating end of the string.

The return value always indicated number of bytes required for the buffer, even when there is no buffer specified, or the buffer size is less then required. In this case, the buffer will not be modified.

Return values:
Numberof bytes the title consumes, including trailing zeros.
DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex ( FPDF_DOCUMENT  document,
FPDF_DEST  dest 
)

Get page index of a destination.

Parameters:
[in]document- Handle to the document.
[in]dest- Handle to the destination.
Return values:
Thepage index. Starting from 0 for the first page.
DLLEXPORT unsigned long STDCALL FPDFDest_GetZoomMode ( FPDF_DEST  dest)

Get the designated zoom mode of a destination.

Parameters:
[in]dest- Handle to the destination.
Return values:
Atype number as the zoom modes.
DLLEXPORT double STDCALL FPDFDest_GetZoomParam ( FPDF_DEST  dest,
int  param 
)

Get zoom parameters.

Parameters:
[in]dest- Handle to the destination.
[in]param- Index of the parameter, starting with zero (see comments below).
Note:
Different zoom mode has different parameters. Here is a list: XYZ Three parameters: x, y position in the page and the zoom ratio (0 for not specified). FITPAGE No parameters; FITHORZ One parameter: the top margin of the page. FITVERT One parameter: the left margin of the page. FITRECT Four parameters: the left, top, right, bottom margin of the fitting rectangle. Use 0-3 as parameter index for them, respectively.
Return values:
Afloat number for the zoom parameter.
DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction ( FPDF_LINK  link)

Get action info of a link.

Parameters:
[in]link- Handle to the link.
Return values:
Handleto the action. NULL if there is no action associated with the link.
DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest ( FPDF_DOCUMENT  document,
FPDF_LINK  link 
)

Get destination info of a link.

Parameters:
[in]document- Handle to the document.
[in]link- Handle to the link. Returned by FPDFLink_GetLinkAtPoint.
Return values:
Handleto the destination. NULL if there is no destination associated with the link, in this case the application should try FPDFLink_GetAction.
DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint ( FPDF_PAGE  page,
double  x,
double  y 
)

Find a link at specified point on a document page.

Parameters:
[in]page- Handle to the document page.
[in]x- The x coordinate of the point, specified in page coordinate system.
[in]y- The y coordinate of the point, specified in page coordinate system.
Note:
The point coordinates are specified in page coordinate system. You can convert coordinates from screen system to page system using FPDF_DeviceToPage functions.
Return values:
Handleto the link. NULL if no link found at that point.