summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-11 15:25:39 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-11 15:25:39 -0700
commit1ed8a21d5c26a9d78240d7d56850a1a4738d3f9c (patch)
tree6dc3c6d9007b5be6843c4e9dbf602a99238080b3 /public
parentea7b333c73ea3e1847e79cabdd85853af67d6d6c (diff)
downloadpdfium-1ed8a21d5c26a9d78240d7d56850a1a4738d3f9c.tar.xz
Merge to XFA: Create top-level public/ header directory.
Original Review URL: https://codereview.chromium.org/1135913002 BUG=pdfium:154 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1136703003
Diffstat (limited to 'public')
-rw-r--r--public/fpdf_dataavail.h223
-rw-r--r--public/fpdf_doc.h273
-rw-r--r--public/fpdf_edit.h281
-rw-r--r--public/fpdf_ext.h108
-rw-r--r--public/fpdf_flatten.h45
-rw-r--r--public/fpdf_formfill.h1261
-rw-r--r--public/fpdf_fwlevent.h286
-rw-r--r--public/fpdf_ppo.h46
-rw-r--r--public/fpdf_progressive.h102
-rw-r--r--public/fpdf_save.h82
-rw-r--r--public/fpdf_searchex.h33
-rw-r--r--public/fpdf_sysfontinfo.h241
-rw-r--r--public/fpdf_text.h322
-rw-r--r--public/fpdf_transformpage.h118
-rw-r--r--public/fpdfview.h776
15 files changed, 4197 insertions, 0 deletions
diff --git a/public/fpdf_dataavail.h b/public/fpdf_dataavail.h
new file mode 100644
index 0000000000..de6cb23bd5
--- /dev/null
+++ b/public/fpdf_dataavail.h
@@ -0,0 +1,223 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDF_DATAAVAIL_H_
+#define _FPDF_DATAAVAIL_H_
+
+#include <stddef.h> // For size_t.
+
+#include "fpdfview.h"
+
+/** The result of the process which check linearized PDF. */
+#define FSDK_IS_LINEARIZED 1
+#define FSDK_NOT_LINEARIZED 0
+#define FSDK_UNKNOW_LINEARIZED -1
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Interface: FX_FILEAVAIL
+ * Interface for checking whether the section of the file is available.
+ */
+typedef struct _FX_FILEAVAIL {
+ /**
+ * Version number of the interface. Currently must be 1.
+ */
+ int version;
+
+ /**
+ * Method: IsDataAvail
+ * Report whether the specified data section is available. A section is available only if all bytes in the section is available.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * Yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * offset - The offset of the data section in the file.
+ * size - The size of the data section
+ * Return Value:
+ * true means the specified data section is available.
+ * Comments:
+ * Called by Foxit SDK to check whether the data section is ready.
+ */
+ bool (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, size_t offset, size_t size);
+} FX_FILEAVAIL;
+
+typedef void* FPDF_AVAIL;
+
+/**
+* Function: FPDFAvail_Create
+* Create a document availability provider.
+*
+* Parameters:
+* file_avail - Pointer to file availability interface to check availability of file data.
+* file - Pointer to a file access interface for reading data from file.
+* Return value:
+* A handle to the document availability provider. NULL for error.
+* Comments:
+* Application must call FPDFAvail_Destroy when done with the availability provider.
+* Notes:
+* The method can not support to load a document which consists of dynamic XFA fields now.
+*/
+DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_FILEACCESS* file);
+
+/**
+* Function: FPDFAvail_Destroy
+* Destroy a document availibity provider.
+*
+* Parameters:
+* avail - Handle to document availability provider returned by FPDFAvail_Create
+* Return Value:
+* None.
+*/
+DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail);
+
+/**
+ * Interface: FX_DOWNLOADHINTS
+ * Download hints interface. Used to receive hints for further downloading.
+ */
+typedef struct _FX_DOWNLOADHINTS {
+ /**
+ * Version number of the interface. Currently must be 1.
+ */
+ int version;
+
+ /**
+ * Method: AddSegment
+ * Add a section to be downloaded.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * Yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * offset - The offset of the hint reported to be downloaded.
+ * size - The size of the hint reported to be downloaded.
+ * Return Value:
+ * None.
+ * Comments:
+ * Called by Foxit SDK to report some downloading hints for download manager.
+ * The position and size of section may be not accurate, part of the section might be already available.
+ * The download manager must deal with that to maximize download efficiency.
+ */
+ void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis, size_t offset, size_t size);
+} FX_DOWNLOADHINTS;
+
+/**
+* Function: FPDFAvail_IsDocAvail
+* Check whether the document is ready for loading, if not, get download hints.
+*
+* Parameters:
+* avail - Handle to document availability provider returned by FPDFAvail_Create
+* hints - Pointer to a download hints interface, receiving generated hints
+* Return value:
+* Non-zero for page is fully available, 0 for page not yet available.
+* Comments:
+* The application should call this function whenever new data arrived, and process all the
+* generated download hints if any, until the function returns non-zero value. Then the
+* application can call FPDFAvail_GetDocument() to get a document handle.
+*/
+DLLEXPORT int STDCALL FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
+
+/**
+* Function: FPDFAvail_GetDocument
+* Get document from the availability provider.
+*
+* Parameters:
+* avail - Handle to document availability provider returned by FPDFAvail_Create
+* password - Optional password for decrypting the PDF file.
+* Return value:
+* Handle to the document.
+* Comments:
+* After FPDFAvail_IsDocAvail() returns TRUE, the application should call this function to
+* get the document handle. To close the document, use FPDF_CloseDocument function.
+*/
+DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail,
+ FPDF_BYTESTRING password);
+
+/**
+* Function: FPDFAvail_GetFirstPageNum
+* Get page number for the first available page in a linearized PDF
+*
+* Parameters:
+* doc - A document handle returned by FPDFAvail_GetDocument
+* Return Value:
+* Zero-based index for the first available page.
+* Comments:
+* For most linearized PDFs, the first available page would be just the first page, however,
+* some PDFs might make other page to be the first available page.
+* For non-linearized PDF, this function will always return zero.
+*/
+DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc);
+
+/**
+* Function: FPDFAvail_IsPageAvail
+* Check whether a page is ready for loading, if not, get download hints.
+*
+* Parameters:
+* avail - Handle to document availability provider returned by FPDFAvail_Create
+* page_index - Index number of the page. 0 for the first page.
+* hints - Pointer to a download hints interface, receiving generated hints
+* Return value:
+* Non-zero for page is fully available, 0 for page not yet available.
+* Comments:
+* This function call be called only after FPDFAvail_GetDocument if called.
+* The application should call this function whenever new data arrived, and process all the
+* generated download hints if any, until the function returns non-zero value. Then the
+* application can perform page loading.
+*/
+DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, int page_index, FX_DOWNLOADHINTS* hints);
+
+/**
+* Function: FPDFAvail_ISFormAvail
+* Check whether Form data is ready for init, if not, get download hints.
+*
+* Parameters:
+* avail - Handle to document availability provider returned by FPDFAvail_Create
+* hints - Pointer to a download hints interface, receiving generated hints
+* Return value:
+* Non-zero for Form data is fully available, 0 for Form data not yet available.
+* Details: -1 - error, the input parameter not correct, such as hints is null.
+* 0 - data not available
+* 1 - data available
+* 2 - no form data.
+* Comments:
+* This function call be called only after FPDFAvail_GetDocument if called.
+* The application should call this function whenever new data arrived, and process all the
+* generated download hints if any, until the function returns non-zero value. Then the
+* application can perform page loading. Recommend to call FPDFDOC_InitFormFillEnvironment
+* after the function returns non-zero value.
+*/
+DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
+
+/**
+* Function: FPDFAvail_IsLinearized
+* To check whether a document is Linearized PDF file.
+*
+* Parameters:
+* avail - Handle to document availability provider returned by FPDFAvail_Create
+* Return value:
+* return TRUE means the document is linearized PDF else not.
+* FSDK_IS_LINEARIZED is a linearize file.
+* FSDK_NOT_LINEARIZED is not a linearize file.
+* FSDK_UNKNOW_LINEARIZED don't know whether the file is a linearize file.
+* Comments:
+* It return TRUE/FALSE as soon as we have first 1K data. If the file's size less than
+* 1K,we don't known whether the PDF is a linearized file.
+*
+*/
+DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
+
diff --git a/public/fpdf_doc.h b/public/fpdf_doc.h
new file mode 100644
index 0000000000..99deab27fe
--- /dev/null
+++ b/public/fpdf_doc.h
@@ -0,0 +1,273 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDFDOC_H_
+#define _FPDFDOC_H_
+
+#include "fpdfview.h"
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDFBookmark_GetFirstChild
+// Get the first child of a bookmark item, or the first top level bookmark item.
+// Parameters:
+// document - Handle to the document. Returned by FPDF_LoadDocument or FPDF_LoadMemDocument.
+// bookmark - Handle to the current bookmark. Can be NULL if you want to get the first top level item.
+// Return value:
+// Handle to the first child or top level bookmark item. NULL if no child or top level bookmark found.
+//
+DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
+
+// Function: FPDFBookmark_GetNextSibling
+// Get next bookmark item at the same level.
+// Parameters:
+// document - Handle to the document. Returned by FPDF_LoadDocument or FPDF_LoadMemDocument.
+// bookmark - Handle to the current bookmark. Cannot be NULL.
+// Return value:
+// Handle to the next bookmark item at the same level. NULL if this is the last bookmark at this level.
+//
+DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
+
+// Function: FPDFBookmark_GetTitle
+// Get title of a bookmark.
+// Parameters:
+// bookmark - Handle to the bookmark.
+// buffer - Buffer for the title. Can be NULL.
+// buflen - The length of the buffer in bytes. Can be 0.
+// Return value:
+// Number of bytes the title consumes, including trailing zeros.
+// Comments:
+// Regardless of the platform, the title is always in UTF-16LE encoding. That means the buffer
+// can be treated as an array of WORD (on Intel and compatible CPUs), each WORD representing the Unicode of
+// a character(some special Unicode may take 2 WORDs).The string is followed by two bytes of zero
+// indicating the end of the string.
+//
+// The return value always indicates the number of bytes required for the buffer, even if no buffer is specified
+// or the buffer size is less then required. In these cases, the buffer will not be modified.
+//
+DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, void* buffer, unsigned long buflen);
+
+// Function: FPDFBookmark_Find
+// Find a bookmark in the document, using the bookmark title.
+// Parameters:
+// document - Handle to the document. Returned by FPDF_LoadDocument or FPDF_LoadMemDocument.
+// title - The UTF-16LE encoded Unicode string for the bookmark title to be searched. Can't be NULL.
+// Return value:
+// Handle to the found bookmark item. NULL if the title can't be found.
+// Comments:
+// It always returns the first found bookmark if more than one bookmarks have the same title.
+//
+DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title);
+
+// Function: FPDFBookmark_GetDest
+// Get the destination associated with a bookmark item.
+// Parameters:
+// document - Handle to the document.
+// bookmark - Handle to the bookmark.
+// Return value:
+// Handle to the destination data. NULL if no destination is associated with this bookmark.
+//
+DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
+
+// Function: FPDFBookmark_GetAction
+// Get the action associated with a bookmark item.
+// Parameters:
+// bookmark - Handle to the bookmark.
+// Return value:
+// Handle to the action data. NULL if no action is associated with this bookmark. In this case, the
+// application should try FPDFBookmark_GetDest.
+//
+DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
+
+#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.
+
+// Function: FPDFAction_GetType
+// Get type of an action.
+// Parameters:
+// action - Handle to the action.
+// Return value:
+// A type number as defined above.
+//
+DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action);
+
+// Function: FPDFAction_GetDest
+// Get destination of an action.
+// Parameters:
+// document - Handle to the document.
+// action - Handle to the action. It must be a GOTO or REMOTEGOTO action.
+// Return value:
+// Handle to the destination data.
+// Comments:
+// 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.
+//
+DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTION action);
+
+// Function: FPDFAction_GetURIPath
+// Get URI path of a URI action.
+// Parameters:
+// document - Handle to the document.
+// action - Handle to the action. Must be a URI action.
+// buffer - A buffer for output the path string. Can be NULL.
+// buflen - The length of the buffer, number of bytes. Can be 0.
+// Return value:
+// Number of bytes the URI path consumes, including trailing zeros.
+// Comments:
+// 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.
+//
+DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_ACTION action,
+ void* buffer, unsigned long buflen);
+
+// Function: FPDFDest_GetPageIndex
+// Get page index of a destination.
+// Parameters:
+// document - Handle to the document.
+// dest - Handle to the destination.
+// Return value:
+// The page index. Starting from 0 for the first page.
+//
+DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FPDF_DEST dest);
+
+// Function: FPDFLink_GetLinkAtPoint
+// Find a link at specified point on a document page.
+// Parameters:
+// page - Handle to the document page.
+// x - The x coordinate of the point, specified in page coordinate system.
+// y - The y coordinate of the point, specified in page coordinate system.
+// Return value:
+// Handle to the link. NULL if no link found at that point.
+// Comments:
+// The point coordinates are specified in page coordinate system. You can convert coordinates
+// from screen system to page system using FPDF_DeviceToPage functions.
+// Notes:
+// The method can not support this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, double y);
+
+// Function: FPDFLink_GetDest
+// Get destination info of a link.
+// Parameters:
+// document - Handle to the document.
+// link - Handle to the link. Returned by FPDFLink_GetLinkAtPoint.
+// Return value:
+// Handle to the destination. NULL if there is no destination associated with the link, in this case
+// the application should try FPDFLink_GetAction.
+//
+DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_LINK link);
+
+// Function: FPDFLink_GetAction
+// Get action info of a link.
+// Parameters:
+// link - Handle to the link.
+// Return value:
+// Handle to the action. NULL if there is no action associated with the link.
+//
+DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link);
+
+// Function: FPDFLink_Enumerate
+// This function would enumerate all the link annotations in a single PDF page.
+// Parameters:
+// page[in] - Handle to the page.
+// startPos[in,out] - The start position to enumerate the link annotations, which should be specified to start from
+// - 0 for the first call, and would receive the next position for enumerating to start from.
+// linkAnnot[out] - Receive the link handle.
+// Return value:
+// TRUE if succceed, else False;
+// Notes:
+// The method can not support this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, int* startPos, FPDF_LINK* linkAnnot);
+
+// Function: FPDFLink_GetAnnotRect
+// Get the annotation rectangle. (Specified by the ¡°Rect¡± entry of annotation dictionary).
+// Parameters:
+// linkAnnot[in] - Handle to the link annotation.
+// rect[out] - The annotation rect.
+// Return value:
+// TRUE if succceed, else False;
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, FS_RECTF* rect);
+
+// Function: FPDFLink_CountQuadPoints
+// Get the count of quadrilateral points to the link annotation.
+// Parameters:
+// linkAnnot[in] - Handle to the link annotation.
+// Return value:
+// The count of quadrilateral points.
+//
+DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot);
+
+/* _FS_DEF_STRUCTURE_QUADPOINTSF_ */
+#ifndef _FS_DEF_STRUCTURE_QUADPOINTSF_
+#define _FS_DEF_STRUCTURE_QUADPOINTSF_
+typedef struct _FS_QUADPOINTSF
+{
+ FS_FLOAT x1;
+ FS_FLOAT y1;
+ FS_FLOAT x2;
+ FS_FLOAT y2;
+ FS_FLOAT x3;
+ FS_FLOAT y3;
+ FS_FLOAT x4;
+ FS_FLOAT y4;
+} FS_QUADPOINTSF;
+#endif /* _FS_DEF_STRUCTURE_QUADPOINTSF_ */
+
+// Function: FPDFLink_GetQuadPoints
+// Get the quadrilateral points for the specified index in the link annotation.
+// Parameters:
+// linkAnnot[in] - Handle to the link annotation.
+// quadIndex[in] - The specified quad points index.
+// quadPoints[out] - Receive the quadrilateral points.
+// Return value:
+// True if succeed, else False.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quadIndex, FS_QUADPOINTSF* quadPoints);
+
+// Function: FPDF_GetMetaText
+// Get a text from meta data of the document. Result is encoded in UTF-16LE.
+// Parameters:
+// doc - Handle to a document
+// 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".
+// buffer - A buffer for output the title. Can be NULL.
+// buflen - The length of the buffer, number of bytes. Can be 0.
+// Return value:
+// Number of bytes the title consumes, including trailing zeros.
+// Comments:
+// 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.
+//
+DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTRING tag,
+ void* buffer, unsigned long buflen);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // _FPDFDOC_H_
diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
new file mode 100644
index 0000000000..3be2fd3112
--- /dev/null
+++ b/public/fpdf_edit.h
@@ -0,0 +1,281 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDFEDIT_H_
+#define _FPDFEDIT_H_
+
+#include "fpdfview.h"
+
+// Define all types used in the SDK. Note they can be simply regarded as opaque pointers
+// or long integer numbers.
+
+#define FPDF_ARGB(a,r,g,b) ((((FX_DWORD)(((FX_BYTE)(b)|((FX_WORD)((FX_BYTE)(g))<<8))|(((FX_DWORD)(FX_BYTE)(r))<<16)))) | (((FX_DWORD)(FX_BYTE)(a))<<24))
+#define FPDF_GetBValue(argb) ((FX_BYTE)(argb))
+#define FPDF_GetGValue(argb) ((FX_BYTE)(((FX_WORD)(argb)) >> 8))
+#define FPDF_GetRValue(argb) ((FX_BYTE)((argb)>>16))
+#define FPDF_GetAValue(argb) ((FX_BYTE)((argb)>>24))
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//////////////////////////////////////////////////////////////////////
+//
+// Document functions
+//
+//////////////////////////////////////////////////////////////////////
+
+// Function: FPDF_CreateNewDocument
+// Create a new PDF document.
+// Parameters:
+// None.
+// Return value:
+// A handle to a document. If failed, NULL is returned.
+//
+DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument();
+
+//////////////////////////////////////////////////////////////////////
+//
+// Page functions
+//
+//////////////////////////////////////////////////////////////////////
+
+// Function: FPDFPage_New
+// Construct an empty page.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
+// page_index - The index of a page.
+// width - The page width.
+// height - The page height.
+// Return value:
+// The handle to the page.
+// Comments:
+// Loaded page can be deleted by FPDFPage_Delete.
+// Notes:
+// The method can not support to create a new page for the document consists of dynamic XFA fields.
+//
+DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, int page_index, double width, double height);
+
+// Function: FPDFPage_Delete
+// Delete a PDF page.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
+// page_index - The index of a page.
+// Return value:
+// None.
+// Notes:
+// The method can not support to delete page for the document consists of dynamic XFA fields.
+//
+DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index);
+
+// Function: FPDFPage_GetRotation
+// Get the page rotation. One of following values will be returned: 0(0), 1(90), 2(180), 3(270).
+// Parameters:
+// page - Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage.
+// Return value:
+// The PDF page rotation.
+// Comment:
+// The PDF page rotation is rotated clockwise.
+// Notes:
+// The method can not support to get the page rotate for the document consists of dynamic XFA fields.
+//
+DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page);
+
+// Function: FPDFPage_SetRotation
+// Set page rotation. One of following values will be set: 0(0), 1(90), 2(180), 3(270).
+// Parameters:
+// page - Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage.
+// rotate - The value of the PDF page rotation.
+// Return value:
+// None.
+// Comment:
+// The PDF page rotation is rotated clockwise.
+// Notes:
+// The method can not support to set this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate);
+
+// Function: FPDFPage_InsertObject
+// Insert an object to the page. The page object is automatically freed.
+// Parameters:
+// page - Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage.
+// page_obj - Handle to a page object. Returned by FPDFPageObj_NewTextObj,FPDFPageObj_NewTextObjEx and
+// FPDFPageObj_NewPathObj.
+// Return value:
+// None.
+// Notes:
+// The method can not support this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_obj);
+
+// Function: FPDFPage_CountObject
+// Get number of page objects inside the page.
+// Parameters:
+// page - Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage.
+// Return value:
+// The number of the page object.
+// Notes:
+// The method can not support this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page);
+
+// Function: FPDFPage_GetObject
+// Get page object by index.
+// Parameters:
+// page - Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage.
+// index - The index of a page object.
+// Return value:
+// The handle of the page object. Null for failed.
+// Notes:
+// The method can not support this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index);
+
+// Function: FPDFPage_HasTransparency
+// Check that whether the content of specified PDF page contains transparency.
+// Parameters:
+// page - Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage.
+// Return value:
+// TRUE means that the PDF page does contains transparency.
+// Otherwise, returns FALSE.
+// Notes:
+// The method can not support this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page);
+
+// Function: FPDFPage_GenerateContent
+// Generate PDF Page content.
+// Parameters:
+// page - Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage.
+// Return value:
+// True if successful, false otherwise.
+// Comment:
+// Before you save the page to a file, or reload the page, you must call the FPDFPage_GenerateContent function.
+// Or the changed information will be lost.
+// Notes:
+// The method can not support this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page);
+
+//////////////////////////////////////////////////////////////////////
+//
+// Page Object functions
+//
+//////////////////////////////////////////////////////////////////////
+
+// Function: FPDFPageObj_HasTransparency
+// Check that whether the specified PDF page object contains transparency.
+// Parameters:
+// pageObject - Handle to a page object.
+// Return value:
+// TRUE means that the PDF page object does contains transparency.
+// Otherwise, returns FALSE.
+DLLEXPORT FPDF_BOOL STDCALL FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject);
+
+// Function: FPDFPageObj_Transform
+// Transform (scale, rotate, shear, move) page object.
+// Parameters:
+// page_object - Handle to a page object. Returned by FPDFPageObj_NewImageObj.
+// a - The coefficient "a" of the matrix.
+// b - The coefficient "b" of the matrix.
+// c - The coefficient "c" of the matrix.
+// d - The coefficient "d" of the matrix.
+// e - The coefficient "e" of the matrix.
+// f - The coefficient "f" of the matrix.
+// Return value:
+// None.
+DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
+ double a, double b, double c, double d, double e, double f);
+
+// Function: FPDFPage_TransformAnnots
+// Transform (scale, rotate, shear, move) all annots in a page.
+// Parameters:
+// page - Handle to a page.
+// a - The coefficient "a" of the matrix.
+// b - The coefficient "b" of the matrix.
+// c - The coefficient "c" of the matrix.
+// d - The coefficient "d" of the matrix.
+// e - The coefficient "e" of the matrix.
+// f - The coefficient "f" of the matrix.
+// Return value:
+// None.
+// Notes:
+// The method can not support this feature for the document consists of dynamic XFA fields.
+DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
+ double a, double b, double c, double d, double e, double f);
+
+// The page object constants.
+#define FPDF_PAGEOBJ_TEXT 1
+#define FPDF_PAGEOBJ_PATH 2
+#define FPDF_PAGEOBJ_IMAGE 3
+#define FPDF_PAGEOBJ_SHADING 4
+#define FPDF_PAGEOBJ_FORM 5
+
+//////////////////////////////////////////////////////////////////////
+//
+// Image functions
+//
+//////////////////////////////////////////////////////////////////////
+
+// Function: FPDFPageObj_NewImgeObj
+// Create a new Image Object.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument or FPDF_CreateNewDocument function.
+// Return Value:
+// Handle of image object.
+DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document);
+
+
+// Function: FPDFImageObj_LoadJpegFile
+// Load Image from a JPEG image file and then set it to an image object.
+// Parameters:
+// pages - Pointers to the start of all loaded pages, could be NULL.
+// nCount - Number of pages, could be 0.
+// image_object - Handle of image object returned by FPDFPageObj_NewImgeObj.
+// fileAccess - The custom file access handler, which specifies the JPEG image file.
+// Return Value:
+// TRUE if successful, FALSE otherwise.
+// Note:
+// The image object might already has an associated image, which is shared and cached by the loaded pages, In this case, we need to clear the cache of image for all the loaded pages.
+// Pass pages and count to this API to clear the image cache.
+// The method can not support this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCount,FPDF_PAGEOBJECT image_object, FPDF_FILEACCESS* fileAccess);
+
+
+// Function: FPDFImageObj_SetMatrix
+// Set the matrix of an image object.
+// Parameters:
+// image_object - Handle of image object returned by FPDFPageObj_NewImgeObj.
+// a - The coefficient "a" of the matrix.
+// b - The coefficient "b" of the matrix.
+// c - The coefficient "c" of the matrix.
+// d - The coefficient "d" of the matrix.
+// e - The coefficient "e" of the matrix.
+// f - The coefficient "f" of the matrix.
+// Return value:
+// TRUE if successful, FALSE otherwise.
+DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
+ double a, double b, double c, double d, double e, double f);
+
+// Function: FPDFImageObj_SetBitmap
+// Set the bitmap to an image object.
+// Parameters:
+// pages - Pointer's to the start of all loaded pages.
+// nCount - Number of pages.
+// image_object - Handle of image object returned by FPDFPageObj_NewImgeObj.
+// bitmap - The handle of the bitmap which you want to set it to the image object.
+// Return value:
+// TRUE if successful, FALSE otherwise.
+// Notes;
+// The method can not support this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,int nCount,FPDF_PAGEOBJECT image_object, FPDF_BITMAP bitmap);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // _FPDFEDIT_H_
diff --git a/public/fpdf_ext.h b/public/fpdf_ext.h
new file mode 100644
index 0000000000..96e3c857fd
--- /dev/null
+++ b/public/fpdf_ext.h
@@ -0,0 +1,108 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDF_EXT_H_
+#define _FPDF_EXT_H_
+
+#ifndef _FPDFVIEW_H_
+#include "fpdfview.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//flags for type of unsupport object.
+#define FPDF_UNSP_DOC_XFAFORM 1
+#define FPDF_UNSP_DOC_PORTABLECOLLECTION 2
+#define FPDF_UNSP_DOC_ATTACHMENT 3
+#define FPDF_UNSP_DOC_SECURITY 4
+#define FPDF_UNSP_DOC_SHAREDREVIEW 5
+#define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT 6
+#define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM 7
+#define FPDF_UNSP_DOC_SHAREDFORM_EMAIL 8
+#define FPDF_UNSP_ANNOT_3DANNOT 11
+#define FPDF_UNSP_ANNOT_MOVIE 12
+#define FPDF_UNSP_ANNOT_SOUND 13
+#define FPDF_UNSP_ANNOT_SCREEN_MEDIA 14
+#define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA 15
+#define FPDF_UNSP_ANNOT_ATTACHMENT 16
+#define FPDF_UNSP_ANNOT_SIG 17
+
+typedef struct _UNSUPPORT_INFO
+{
+ /**
+ * Version number of the interface. Currently must be 1.
+ **/
+ int version;
+
+ /**
+ * Method: FSDK_UnSupport_Handler
+ * UnSupport Object process handling function.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * Yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * nType - The type of unsupportObject
+ * Return value:
+ * None.
+ * */
+
+ void(*FSDK_UnSupport_Handler)(_UNSUPPORT_INFO* pThis,int nType);
+}UNSUPPORT_INFO;
+
+
+/**
+ * Function: FSDK_SetUnSpObjProcessHandler
+ * Setup A UnSupport Object process handler for foxit sdk.
+ * Parameters:
+ * unsp_info - Pointer to a UNSUPPORT_INFO structure.
+ * Return Value:
+ * TRUE means successful. FALSE means fails.
+ **/
+
+DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);
+
+//flags for page mode.
+
+//Unknown value
+#define PAGEMODE_UNKNOWN -1
+
+//Neither document outline nor thumbnail images visible
+#define PAGEMODE_USENONE 0
+
+//Document outline visible
+#define PAGEMODE_USEOUTLINES 1
+
+//Thumbnial images visible
+#define PAGEMODE_USETHUMBS 2
+
+//Full-screen mode, with no menu bar, window controls, or any other window visible
+#define PAGEMODE_FULLSCREEN 3
+
+//Optional content group panel visible
+#define PAGEMODE_USEOC 4
+
+//Attachments panel visible
+#define PAGEMODE_USEATTACHMENTS 5
+
+
+/**
+ * Function: FPDFDoc_GetPageMode
+ * Get the document's PageMode(How the document should be displayed when opened)
+ * Parameters:
+ * doc - Handle to document. Returned by FPDF_LoadDocument function.
+ * Return Value:
+ * The flags for page mode.
+ **/
+DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document);
+
+#ifdef __cplusplus
+};
+#endif
+#endif
diff --git a/public/fpdf_flatten.h b/public/fpdf_flatten.h
new file mode 100644
index 0000000000..0c555138ab
--- /dev/null
+++ b/public/fpdf_flatten.h
@@ -0,0 +1,45 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDF_FLATTEN_H_
+#define _FPDF_FLATTEN_H_
+
+#include "fpdfview.h"
+
+#define FLATTEN_FAIL 0 // Flatten operation failed.
+#define FLATTEN_SUCCESS 1 // Flatten operation succeed.
+#define FLATTEN_NOTINGTODO 2 // There is nothing can be flatten.
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define FLAT_NORMALDISPLAY 0
+#define FLAT_PRINT 1
+ //Function: FPDFPage_Flatten
+
+ // Flat a pdf page,annotations or form fields will become part of the page contents.
+ //Parameters:
+
+ // page - Handle to the page. Returned by FPDF_LoadPage function.
+ // nFlag - the flag for the use of flatten result. Zero for normal display, 1 for print.
+ //Return value:
+ // The result flag of the function, See flags above ( FLATTEN_FAIL, FLATTEN_SUCCESS, FLATTEN_NOTINGTODO ).
+ //
+ //Comments: Current version all fails return zero. If necessary we will assign different value
+ // to indicate different fail reason.
+ //
+ //Notes:
+ // The method can not support to flatten the page which the document consists of dynamic XFA fields.
+ //
+ DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif //_FPDF_FLATTEN_H_
diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h
new file mode 100644
index 0000000000..5191fd75a8
--- /dev/null
+++ b/public/fpdf_formfill.h
@@ -0,0 +1,1261 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+
+#ifndef _FPDFORMFILL_H
+#define _FPDFORMFILL_H
+#include "fpdfview.h"
+
+typedef void* FPDF_FORMHANDLE;
+
+#define DOCTYPE_PDF 0 //Normal pdf Document
+#define DOCTYPE_DYNIMIC_XFA 1 //Dynimic xfa Document Type
+#define DOCTYPE_STATIC_XFA 2 //Static xfa Document Type
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _IPDF_JsPlatform
+{
+/**
+* Version number of the interface. Currently must be 1.
+ **/
+ int version;
+
+ /**
+ * Method: app_alert
+ * pop up a dialog to show warning or hint.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * Msg - A string containing the message to be displayed.
+ * Title - The title of the dialog.
+ * Type - The stype of button group.
+ * 0-OK(default);
+ * 1-OK,Cancel;
+ * 2-Yes,NO;
+ * 3-Yes, NO, Cancel.
+ * nIcon - The Icon type.
+ * 0-Error(default);
+ * 1-Warning;
+ * 2-Question;
+ * 3-Status.
+ * 4-Asterisk
+
+ * Return Value:
+ * The return value could be the folowing type:
+ * 1-OK;
+ * 2-Cancel;
+ * 3-NO;
+ * 4-Yes;
+ */
+ int (*app_alert)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon);
+
+ /**
+ * Method: app_beep
+ * Causes the system to play a sound.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * nType - The sound type.
+ * 0 - Error
+ * 1 - Warning
+ * 2 - Question
+ * 3 - Status
+ * 4 - Default (default value)
+ * Return Value:
+ * None
+ */
+ void (*app_beep)(struct _IPDF_JsPlatform* pThis, int nType);
+
+ /**
+ * Method: app_response
+ * Displays a dialog box containing a question and an entry field for the user to reply to the question.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * Question - The question to be posed to the user.
+ * Title - The title of the dialog box.
+ * Default - A default value for the answer to the question. If not specified, no default value is presented.
+ * cLabel - A short string to appear in front of and on the same line as the edit text field.
+ * bPassword - If true, indicates that the user's response should show as asterisks (*) or bullets (?) to mask the response, which might be sensitive information. The default is false.
+ * response - A string buffer allocated by SDK, to receive the user's response.
+ * length - The length of the buffer, number of bytes. Currently, It's always be 2048.
+ * Return Value:
+ * Number of bytes the complete user input would actually require, not including trailing zeros, regardless of the value of the length
+ * parameter or the presence of the response buffer.
+ * Comments:
+ * No matter on what platform, the response buffer should be always written using UTF-16LE encoding. If a response buffer is
+ * present and the size of the user input exceeds the capacity of the buffer as specified by the length parameter, only the
+ * first "length" bytes of the user input are to be written to the buffer.
+ */
+ int (*app_response)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Question, FPDF_WIDESTRING Title, FPDF_WIDESTRING Default, FPDF_WIDESTRING cLabel, FPDF_BOOL bPassword, void* response, int length);
+
+ /*
+ * Method: Doc_getFilePath
+ * Get the file path of the current document.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * filePath - The string buffer to receive the file path. Can be NULL.
+ * length - The length of the buffer, number of bytes. Can be 0.
+ * Return Value:
+ * Number of bytes the filePath consumes, including trailing zeros.
+ * Comments:
+ * The filePath should be always input 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.
+ */
+ int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis, void* filePath, int length);
+
+
+ /*
+ * Method: Doc_mail
+ * Mails the data buffer as an attachment to all recipients, with or without user interaction.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * mailData - Pointer to the data buffer to be sent.Can be NULL.
+ * length - The size,in bytes, of the buffer pointed by mailData parameter.Can be 0.
+ * bUI - If true, the rest of the parameters are used in a compose-new-message window that is displayed to the user. If false, the cTo parameter is required and all others are optional.
+ * To - A semicolon-delimited list of recipients for the message.
+ * Subject - The subject of the message. The length limit is 64 KB.
+ * CC - A semicolon-delimited list of CC recipients for the message.
+ * BCC - A semicolon-delimited list of BCC recipients for the message.
+ * Msg - The content of the message. The length limit is 64 KB.
+ * Return Value:
+ * None.
+ * Comments:
+ * If the parameter mailData is NULL or length is 0, the current document will be mailed as an attachment to all recipients.
+ */
+ void (*Doc_mail)(struct _IPDF_JsPlatform* pThis,void* mailData, int length,FPDF_BOOL bUI, FPDF_WIDESTRING To, FPDF_WIDESTRING Subject, FPDF_WIDESTRING CC, FPDF_WIDESTRING BCC, FPDF_WIDESTRING Msg);
+
+
+ /*
+ * Method: Doc_print
+ * Prints all or a specific number of pages of the document.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * bUI - If true, will cause a UI to be presented to the user to obtain printing information and confirm the action.
+ * nStart - A 0-based index that defines the start of an inclusive range of pages.
+ * nEnd - A 0-based index that defines the end of an inclusive page range.
+ * bSilent - If true, suppresses the cancel dialog box while the document is printing. The default is false.
+ * bShrinkToFit - If true, the page is shrunk (if necessary) to fit within the imageable area of the printed page.
+ * bPrintAsImage - If true, print pages as an image.
+ * bReverse - If true, print from nEnd to nStart.
+ * bAnnotations - If true (the default), annotations are printed.
+ */
+ void (*Doc_print)(struct _IPDF_JsPlatform* pThis, FPDF_BOOL bUI, int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations);
+
+ /*
+ * Method: Doc_submitForm
+ * Send the form data to a specified URL.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * formData - Pointer to the data buffer to be sent.
+ * length - The size,in bytes, of the buffer pointed by formData parameter.
+ * URL - The URL to send to.
+ * Return Value:
+ * None.
+ *
+ */
+ void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis,void* formData, int length, FPDF_WIDESTRING URL);
+
+ /*
+ * Method: Doc_gotoPage
+ * Jump to a specified page.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * nPageNum - The specified page number, zero for the first page.
+ * Return Value:
+ * None.
+ *
+ */
+ void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum);
+ /*
+ * Method: Field_browse
+ * Show a file selection dialog, and return the selected file path.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * filePath - Pointer to the data buffer to receive the file path.Can be NULL.
+ * length - The length of the buffer, number of bytes. Can be 0.
+ * Return Value:
+ * Number of bytes the filePath consumes, including trailing zeros.
+ * Comments:
+ * The filePath shoule be always input in local encoding.
+ */
+ int (*Field_browse)(struct _IPDF_JsPlatform* pThis, void* filePath, int length);
+
+ /**
+ * pointer to FPDF_FORMFILLINFO interface.
+ **/
+ void* m_pFormfillinfo;
+} IPDF_JSPLATFORM;
+
+// Flags for Cursor type
+#define FXCT_ARROW 0
+#define FXCT_NESW 1
+#define FXCT_NWSE 2
+#define FXCT_VBEAM 3
+#define FXCT_HBEAM 4
+#define FXCT_HAND 5
+
+/**
+ * Declares of a pointer type to the callback function for the FFI_SetTimer method.
+ * Parameters:
+ * idEvent - Identifier of the timer.
+ * Return value:
+ * None.
+ **/
+typedef void (*TimerCallback)(int idEvent);
+
+/**
+ * Declares of a struct type to the local system time.
+**/
+typedef struct _FPDF_SYSTEMTIME
+{
+ unsigned short wYear; /* years since 1900 */
+ unsigned short wMonth; /* months since January - [0,11] */
+ unsigned short wDayOfWeek; /* days since Sunday - [0,6] */
+ unsigned short wDay; /* day of the month - [1,31] */
+ unsigned short wHour; /* hours since midnight - [0,23] */
+ unsigned short wMinute; /* minutes after the hour - [0,59] */
+ unsigned short wSecond; /* seconds after the minute - [0,59] */
+ unsigned short wMilliseconds; /* milliseconds after the second - [0,999] */
+}FPDF_SYSTEMTIME;
+
+//XFA
+/**
+ * @name Pageview event flags
+ */
+/*@{*/
+/** @brief After a new pageview is added. */
+#define FXFA_PAGEVIEWEVENT_POSTADDED 1
+/** @brief After a pageview is removed. */
+#define FXFA_PAGEVIEWEVENT_POSTREMOVED 3
+/*@}*/
+
+// menu
+/**
+ * @name Macro Definitions for Right Context Menu Features Of XFA Fields
+ */
+/*@{*/
+#define FXFA_MEMU_COPY 1
+#define FXFA_MEMU_CUT 2
+#define FXFA_MEMU_SELECTALL 4
+#define FXFA_MEMU_UNDO 8
+#define FXFA_MEMU_REDO 16
+#define FXFA_MEMU_PASTE 32
+/*@}*/
+
+// file type
+/**
+ * @name Macro Definitions for File Type.
+ */
+/*@{*/
+#define FXFA_SAVEAS_XML 1
+#define FXFA_SAVEAS_XDP 2
+/*@}*/
+
+typedef struct _FPDF_FORMFILLINFO
+{
+ /**
+ * Version number of the interface. Currently must be 2 (with XFA module).
+ **/
+ int version;
+
+ /**
+ * Method: Release
+ * Give implementation a chance to release any data after the interface is no longer used
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * No
+ * Comments:
+ * Called by Foxit SDK during the final cleanup process.
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * Return Value:
+ * None
+ */
+
+ void (*Release)(struct _FPDF_FORMFILLINFO* pThis);
+
+ /**
+ * Method: FFI_Invalidate
+ * Invalidate the client area within the specified rectangle.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * page - Handle to the page. Returned by FPDF_LoadPage function.
+ * left - Left position of the client area in PDF page coordinate.
+ * top - Top position of the client area in PDF page coordinate.
+ * right - Right position of the client area in PDF page coordinate.
+ * bottom - Bottom position of the client area in PDF page coordinate.
+ * Return Value:
+ * None.
+ *
+ *comments:
+ * All positions are measured in PDF "user space".
+ * Implementation should call FPDF_RenderPageBitmap() function for repainting a specified page area.
+ */
+ void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);
+
+ /**
+ * Method: FFI_OutputSelectedRect
+ * When user is taking the mouse to select texts on a form field, this callback function will keep
+ * returning the selected areas to the implementation.
+ *
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * No
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * page - Handle to the page. Returned by FPDF_LoadPage function.
+ * left - Left position of the client area in PDF page coordinate.
+ * top - Top position of the client area in PDF page coordinate.
+ * right - Right position of the client area in PDF page coordinate.
+ * bottom - Bottom position of the client area in PDF page coordinate.
+ * Return Value:
+ * None.
+ *
+ * comments:
+ * This CALLBACK function is useful for implementing special text selection effect. Implementation should
+ * first records the returned rectangles, then draw them one by one at the painting period, last,remove all
+ * the recorded rectangles when finish painting.
+ */
+ void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis,FPDF_PAGE page, double left, double top, double right, double bottom);
+
+ /**
+ * Method: FFI_SetCursor
+ * Set the Cursor shape.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * nCursorType - Cursor type. see Flags for Cursor type for the details.
+ * Return value:
+ * None.
+ * */
+ void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType);
+
+ /**
+ * Method: FFI_SetTimer
+ * This method installs a system timer. A time-out value is specified,
+ * and every time a time-out occurs, the system passes a message to
+ * the TimerProc callback function.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * uElapse - Specifies the time-out value, in milliseconds.
+ * lpTimerFunc - A pointer to the callback function-TimerCallback.
+ * Return value:
+ * The timer identifier of the new timer if the function is successful.
+ * An application passes this value to the FFI_KillTimer method to kill
+ * the timer. Nonzero if it is successful; otherwise, it is zero.
+ * */
+ int (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis, int uElapse, TimerCallback lpTimerFunc);
+
+ /**
+ * Method: FFI_KillTimer
+ * This method kills the timer event identified by nIDEvent, set by an earlier call to FFI_SetTimer.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * nTimerID - The timer ID return by FFI_SetTimer function.
+ * Return value:
+ * None.
+ * */
+ void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID);
+
+
+ /**
+ * Method: FFI_GetLocalTime
+ * This method receives the current local time on the system.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * Return value:
+ * None.
+ * */
+ FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis);
+
+ /**
+ * Method: FFI_OnChange
+ * This method will be invoked to notify implementation when the value of any FormField on the document had been changed.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * no
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * Return value:
+ * None.
+ * */
+ void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis);
+
+ /**
+ * Method: FFI_GetPage
+ * This method receives the page pointer associated with a specified page index.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * nPageIndex - Index number of the page. 0 for the first page.
+ * Return value:
+ * Handle to the page. Returned by FPDF_LoadPage function.
+ * Comments:
+ * In some cases, the document-level JavaScript action may refer to a page which hadn't been loaded yet.
+ * To successfully run the javascript action, implementation need to load the page for SDK.
+ * */
+ FPDF_PAGE (*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, int nPageIndex);
+
+ /**
+ * Method: FFI_GetCurrentPage
+ * This method receives the current page pointer.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * Return value:
+ * Handle to the page. Returned by FPDF_LoadPage function.
+ * */
+ FPDF_PAGE (*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document);
+
+ /**
+ * Method: FFI_GetRotation
+ * This method receives currently rotation of the page view.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * page - Handle to page. Returned by FPDF_LoadPage function.
+ * Return value:
+ * The page rotation. Should be 0(0 degree),1(90 degree),2(180 degree),3(270 degree), in a clockwise direction.
+ * */
+ int (*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page);
+
+ /**
+ * Method: FFI_ExecuteNamedAction
+ * This method will execute an named action.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * namedAction - A byte string which indicates the named action, terminated by 0.
+ * Return value:
+ * None.
+ * Comments:
+ * See the named actions description of <<PDF Reference, version 1.7>> for more details.
+ * */
+ void (*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING namedAction);
+ /**
+ * @brief This method will be called when a text field is getting or losing a focus.
+ *
+ * @param[in] pThis Pointer to the interface structure itself.
+ * @param[in] value The string value of the form field, in UTF-16LE format.
+ * @param[in] valueLen The length of the string value, number of characters (not bytes).
+ * @param[in] is_focus True if the form field is getting a focus, False for losing a focus.
+ *
+ * @return None.
+ *
+ * @note Currently,only support text field and combobox field.
+ * */
+ void (*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING value, FPDF_DWORD valueLen, FPDF_BOOL is_focus);
+
+
+ /**
+ * Method: FFI_DoURIAction
+ * This action resolves to a uniform resource identifier.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * No
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * bsURI - A byte string which indicates the uniform resource identifier, terminated by 0.
+ * Return value:
+ * None.
+ * Comments:
+ * See the URI actions description of <<PDF Reference, version 1.7>> for more details.
+ * */
+ void (*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis, FPDF_BYTESTRING bsURI);
+
+ /**
+ * Method: FFI_DoGoToAction
+ * This action changes the view to a specified destination.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * No
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * nPageIndex - The index of the PDF page.
+ * zoomMode - The zoom mode for viewing page.See Macros "PDFZOOM_XXX" defined in "fpdfdoc.h".
+ * fPosArray - The float array which carries the position info.
+ * sizeofArray - The size of float array.
+ * Return value:
+ * None.
+ * Comments:
+ * See the Destinations description of <<PDF Reference, version 1.7>> in 8.2.1 for more details.
+ **/
+ void (*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis, int nPageIndex, int zoomMode, float* fPosArray, int sizeofArray);
+
+ /**
+ * pointer to IPDF_JSPLATFORM interface
+ **/
+ IPDF_JSPLATFORM* m_pJsPlatform;
+
+ /**
+ * Method: FFI_DisplayCaret
+ * This method will show the caret at specified position.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * page - Handle to page. Returned by FPDF_LoadPage function.
+ * left - Left position of the client area in PDF page coordinate.
+ * top - Top position of the client area in PDF page coordinate.
+ * right - Right position of the client area in PDF page coordinate.
+ * bottom - Bottom position of the client area in PDF page coordinate.
+ * Return value:
+ * None.
+ **/
+ void (*FFI_DisplayCaret)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_BOOL bVisible, double left, double top, double right, double bottom);
+ /**
+ * Method: FFI_GetCurrentPageIndex
+ * This method will get the current page index.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * Return value:
+ * The index of current page.
+ **/
+ int (*FFI_GetCurrentPageIndex)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document);
+ /**
+ * Method: FFI_SetCurrentPage
+ * This method will set the current page.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * iCurPage - The index of the PDF page.
+ * Return value:
+ * None.
+ **/
+ void (*FFI_SetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, int iCurPage);
+ /**
+ * Method: FFI_GotoURL
+ * This method will link to the specified URL.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * no
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * wsURL - The string value of the URL, in UTF-16LE format.
+ * Return value:
+ * None.
+ **/
+ void (*FFI_GotoURL)(struct _FPDF_FORMFILLINFO* pThis, FPDF_DOCUMENT document, FPDF_WIDESTRING wsURL);
+ /**
+ * Method: FFI_GetPageViewRect
+ * This method will get the current page view rectangle.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * page - Handle to page. Returned by FPDF_LoadPage function.
+ * left - The pointer to receive left position of the page view area in PDF page coordinate.
+ * top - The pointer to receive top position of the page view area in PDF page coordinate.
+ * right - The pointer to receive right position of the client area in PDF page coordinate.
+ * bottom - The pointer to receive bottom position of the client area in PDF page coordinate.
+ * Return value:
+ * None.
+ **/
+ void (*FFI_GetPageViewRect)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, double* left, double* top, double* right, double* bottom);
+ /**
+ * Method: FFI_PopupMenu
+ * This method will track the right context menu for XFA fields.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * page - Handle to page. Returned by FPDF_LoadPage function.
+ * hWidget - Handle to XFA fields.
+ * menuFlag - The menu flags. Please refer to macro definition of FXFA_MEMU_XXX and this can be one or a combination of these macros.
+ * x - X position of the client area in PDF page coordinate.
+ * y - Y position of the client area in PDF page coordinate.
+ * Return value:
+ * TRUE indicates success; otherwise false.
+ **/
+ FPDF_BOOL (*FFI_PopupMenu)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_WIDGET hWidget, int menuFlag, float x, float y);
+ /**
+ * Method: FFI_OpenFile
+ * This method will open the specified file with the specified mode.
+ * Interface Version
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * fileFlag - The file flag.Please refer to macro definition of FXFA_SAVEAS_XXX and this can be one of these macros.
+ * wsURL - The string value of the file URL, in UTF-16LE format.
+ * mode - The mode for open file.
+ * Return value:
+ * The handle to FPDF_FILEHANDLER.
+ **/
+ FPDF_FILEHANDLER* (*FFI_OpenFile)(struct _FPDF_FORMFILLINFO* pThis, int fileFlag, FPDF_WIDESTRING wsURL, const char* mode);
+ /**
+ * Method: FFI_EmailTo
+ * This method will email the specified file stream to the specified contacter.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * pFileHandler - Handle to the FPDF_FILEHANDLER.
+ * pTo - A semicolon-delimited list of recipients for the message,in UTF-16LE format.
+ * pSubject - The subject of the message,in UTF-16LE format.
+ * pCC - A semicolon-delimited list of CC recipients for the message,in UTF-16LE format.
+ * pBcc - A semicolon-delimited list of BCC recipients for the message,in UTF-16LE format.
+ * pMsg - Pointer to the data buffer to be sent.Can be NULL,in UTF-16LE format.
+ * Return value:
+ * None.
+ **/
+ void (*FFI_EmailTo)(struct _FPDF_FORMFILLINFO* pThis, FPDF_FILEHANDLER* fileHandler, FPDF_WIDESTRING pTo, FPDF_WIDESTRING pSubject, FPDF_WIDESTRING pCC, FPDF_WIDESTRING pBcc, FPDF_WIDESTRING pMsg);
+ /**
+ * Method: FFI_UploadTo
+ * This method will get upload the specified file stream to the specified URL.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * pFileHandler - Handle to the FPDF_FILEHANDLER.
+ * fileFlag - The file flag.Please refer to macro definition of FXFA_SAVEAS_XXX and this can be one of these macros.
+ * uploadTo - Pointer to the URL path, in UTF-16LE format.
+ * Return value:
+ * None.
+ **/
+ void (*FFI_UploadTo)(struct _FPDF_FORMFILLINFO* pThis, FPDF_FILEHANDLER* fileHandler, int fileFlag, FPDF_WIDESTRING uploadTo);
+
+ /**
+ * Method: FFI_GetPlatform
+ * This method will get the current platform.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * platform - Pointer to the data buffer to receive the platform.Can be NULL,in UTF-16LE format.
+ * length - The length of the buffer, number of bytes. Can be 0.
+ * Return value:
+ * The length of the buffer, number of bytes.
+ **/
+ int (*FFI_GetPlatform)(struct _FPDF_FORMFILLINFO* pThis, void* platform, int length);
+ /**
+ * Method: FFI_GetLanguage
+ * This method will get the current language.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * language - Pointer to the data buffer to receive the current language.Can be NULL.
+ * length - The length of the buffer, number of bytes. Can be 0.
+ * Return value:
+ * The length of the buffer, number of bytes.
+ **/
+ int (*FFI_GetLanguage)(struct _FPDF_FORMFILLINFO* pThis, void* language, int length);
+ /**
+ * Method: FFI_DownloadFromURL
+ * This method will download the specified file from the URL.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * URL - The string value of the file URL, in UTF-16LE format.
+ * Return value:
+ * The handle to FPDF_FILEHANDLER.
+ **/
+ FPDF_LPFILEHANDLER (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING URL);
+ /**
+ * Method: FFI_PostRequestURL
+ * This method will post the request to the server URL.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * wsURL - The string value of the server URL, in UTF-16LE format.
+ * wsData - The post data,in UTF-16LE format.
+ * wsContentType - The content type of the request data,in UTF-16LE format.
+ * wsEncode - The encode type,in UTF-16LE format.
+ * wsHeader - The request header,in UTF-16LE format.
+ * response - Pointer to the FPDF_BSTR to receive the response data from server,,in UTF-16LE format.
+ * Return value:
+ * TRUE indicates success, otherwise FALSE.
+ **/
+ FPDF_BOOL (*FFI_PostRequestURL)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING wsURL, FPDF_WIDESTRING wsData, FPDF_WIDESTRING wsContentType, FPDF_WIDESTRING wsEncode, FPDF_WIDESTRING wsHeader, FPDF_BSTR* respone);
+ /**
+ * Method: FFI_PutRequestURL
+ * This method will put the request to the server URL.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself.
+ * wsURL - The string value of the server URL, in UTF-16LE format.
+ * wsData - The put data, in UTF-16LE format.
+ * wsEncode - The encode type, in UTR-16LE format.
+ * Return value:
+ * TRUE indicates success, otherwise FALSE.
+ **/
+ FPDF_BOOL (*FFI_PutRequestURL)(struct _FPDF_FORMFILLINFO* pThis, FPDF_WIDESTRING wsURL, FPDF_WIDESTRING wsData, FPDF_WIDESTRING wsEncode);
+
+} FPDF_FORMFILLINFO;
+
+
+
+/**
+ * Function: FPDFDOC_InitFormFillEnvironment
+ * Init form fill environment.
+ * Comments:
+ * This function should be called before any form fill operation.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * pFormFillInfo - Pointer to a FPDF_FORMFILLINFO structure.
+ * Return Value:
+ * Return handler to the form fill module. NULL means fails.
+ **/
+DLLEXPORT FPDF_FORMHANDLE STDCALL FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, FPDF_FORMFILLINFO* formInfo);
+
+/**
+ * Function: FPDFDOC_ExitFormFillEnvironment
+ * Exit form fill environment.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * Return Value:
+ * NULL.
+ **/
+DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle);
+
+/**
+ * Function: FORM_OnAfterLoadPage
+ * This method is required for implementing all the form related functions. Should be invoked after user
+ * successfully loaded a PDF page, and method FPDFDOC_InitFormFillEnvironment had been invoked.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * Return Value:
+ * NONE.
+ **/
+DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);
+
+/**
+ * Function: FORM_OnBeforeClosePage
+ * This method is required for implementing all the form related functions. Should be invoked before user
+ * close the PDF page.
+ * Parameters:
+ * page - Handle to the page. Returned by FPDF_LoadPage function.
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * Return Value:
+ * NONE.
+ **/
+DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, FPDF_FORMHANDLE hHandle);
+
+/**
+* Function: FORM_DoDocumentJSAction
+* This method is required for performing Document-level JavaScript action. It should be invoked after the PDF document
+* had been loaded.
+* Parameters:
+* hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+* Return Value:
+* NONE
+* Comments:
+* If there is Document-level JavaScript action embedded in the document, this method will execute the javascript action;
+* otherwise, the method will do nothing.
+**/
+DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle);
+
+
+/**
+* Function: FORM_DoDocumentOpenAction
+* This method is required for performing open-action when the document is opened.
+* Parameters:
+* hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+* Return Value:
+* NONE
+* Comments:
+* This method will do nothing if there is no open-actions embedded in the document.
+**/
+DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle);
+
+
+// additional actions type of document.
+#define FPDFDOC_AACTION_WC 0x10 //WC, before closing document, JavaScript action.
+#define FPDFDOC_AACTION_WS 0x11 //WS, before saving document, JavaScript action.
+#define FPDFDOC_AACTION_DS 0x12 //DS, after saving document, JavaScript action.
+#define FPDFDOC_AACTION_WP 0x13 //WP, before printing document, JavaScript action.
+#define FPDFDOC_AACTION_DP 0x14 //DP, after printing document, JavaScript action.
+/**
+* Function: FORM_DoDocumentAAction
+* This method is required for performing the document's additional-action.
+* Parameters:
+* hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+* aaType - The type of the additional-actions which defined above.
+* Return Value:
+* NONE
+* Comments:
+* This method will do nothing if there is no document additional-action corresponding to the specified aaType.
+**/
+
+DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, int aaType);
+
+// Additional-action types of page object
+#define FPDFPAGE_AACTION_OPEN 0 // /O -- An action to be performed when the page is opened
+#define FPDFPAGE_AACTION_CLOSE 1 // /C -- An action to be performed when the page is closed
+
+/**
+* Function: FORM_DoPageAAction
+* This method is required for performing the page object's additional-action when opened or closed.
+* Parameters:
+* page - Handle to the page. Returned by FPDF_LoadPage function.
+* hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+* aaType - The type of the page object's additional-actions which defined above.
+* Return Value:
+* NONE
+* Comments:
+* This method will do nothing if no additional-action corresponding to the specified aaType exists.
+**/
+DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, FPDF_FORMHANDLE hHandle, int aaType);
+
+/**
+ * Function: FORM_OnMouseMove
+ * You can call this member function when the mouse cursor moves.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * page - Handle to the page. Returned by FPDF_LoadPage function.
+ * modifier - Indicates whether various virtual keys are down.
+ * page_x - Specifies the x-coordinate of the cursor in PDF user space.
+ * page_y - Specifies the y-coordinate of the cursor in PDF user space.
+ * Return Value:
+ * TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
+
+/**
+ * Function: FORM_OnLButtonDown
+ * You can call this member function when the user presses the left mouse button.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * page - Handle to the page. Returned by FPDF_LoadPage function.
+ * modifier - Indicates whether various virtual keys are down.
+ * page_x - Specifies the x-coordinate of the cursor in PDF user space.
+ * page_y - Specifies the y-coordinate of the cursor in PDF user space.
+ * Return Value:
+ * TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
+
+/**
+ * Function: FORM_OnLButtonUp
+ * You can call this member function when the user releases the left mouse button.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * page - Handle to the page. Returned by FPDF_LoadPage function.
+ * modifier - Indicates whether various virtual keys are down.
+ * page_x - Specifies the x-coordinate of the cursor in device.
+ * page_y - Specifies the y-coordinate of the cursor in device.
+ * Return Value:
+ * TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int modifier, double page_x, double page_y);
+
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y);
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int modifier, double page_x, double page_y);
+
+/**
+ * Function: FORM_OnKeyDown
+ * You can call this member function when a nonsystem key is pressed.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * page - Handle to the page. Returned by FPDF_LoadPage function.
+ * nKeyCode - Indicates whether various virtual keys are down.
+ * modifier - Contains the scan code, key-transition code, previous key state, and context code.
+ * Return Value:
+ * TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);
+
+/**
+ * Function: FORM_OnKeyUp
+ * You can call this member function when a nonsystem key is released.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * page - Handle to the page. Returned by FPDF_LoadPage function.
+ * nKeyCode - The virtual-key code of the given key.
+ * modifier - Contains the scan code, key-transition code, previous key state, and context code.
+ * Return Value:
+ * TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nKeyCode, int modifier);
+
+/**
+ * Function: FORM_OnChar
+ * You can call this member function when a keystroke translates to a nonsystem character.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * page - Handle to the page. Returned by FPDF_LoadPage function.
+ * nChar - The character code value of the key.
+ * modifier - Contains the scan code, key-transition code, previous key state, and context code.
+ * Return Value:
+ * TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle,FPDF_PAGE page, int nChar, int modifier);
+
+/**
+ * Function: FORM_ForceToKillFocus.
+ * You can call this member function to force to kill the focus of the form field which got focus.
+ * It would kill the focus on the form field, save the value of form field if it's changed by user.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * Return Value:
+ * TRUE indicates success; otherwise false.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle);
+
+// Field Types
+#define FPDF_FORMFIELD_UNKNOWN 0 // Unknown.
+#define FPDF_FORMFIELD_PUSHBUTTON 1 // push button type.
+#define FPDF_FORMFIELD_CHECKBOX 2 // check box type.
+#define FPDF_FORMFIELD_RADIOBUTTON 3 // radio button type.
+#define FPDF_FORMFIELD_COMBOBOX 4 // combo box type.
+#define FPDF_FORMFIELD_LISTBOX 5 // list box type.
+#define FPDF_FORMFIELD_TEXTFIELD 6 // text field type.
+#define FPDF_FORMFIELD_XFA 7 // text field type.
+/**
+ * Function: FPDPage_HasFormFieldAtPoint
+ * Check the form filed position by point.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * page - Handle to the page. Returned by FPDF_LoadPage function.
+ * page_x - X position in PDF "user space".
+ * page_y - Y position in PDF "user space".
+ * Return Value:
+ * Return the type of the formfiled; -1 indicates no fields.
+ **/
+DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,FPDF_PAGE page,double page_x, double page_y);
+
+/**
+ * Function: FPDF_SetFormFieldHighlightColor
+ * Set the highlight color of specified or all the form fields in the document.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * doc - Handle to the document. Returned by FPDF_LoadDocument function.
+ * fieldType - A 32-bit integer indicating the type of a form field(defined above).
+ * color - The highlight color of the form field.Constructed by 0xxxrrggbb.
+ * Return Value:
+ * NONE.
+ * Comments:
+ * When the parameter fieldType is set to zero, the highlight color will be applied to all the form fields in the
+ * document.
+ * Please refresh the client window to show the highlight immediately if necessary.
+ **/
+DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, int fieldType, unsigned long color);
+
+/**
+ * Function: FPDF_SetFormFieldHighlightAlpha
+ * Set the transparency of the form field highlight color in the document.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * doc - Handle to the document. Returned by FPDF_LoadDocument function.
+ * alpha - The transparency of the form field highlight color. between 0-255.
+ * Return Value:
+ * NONE.
+ **/
+DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha);
+
+
+/**
+ * Function: FPDF_RemoveFormFieldHighlight
+ * Remove the form field highlight color in the document.
+ * Parameters:
+ * hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+ * Return Value:
+ * NONE.
+ * Comments:
+ * Please refresh the client window to remove the highlight immediately if necessary.
+ **/
+DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle);
+
+/**
+* Function: FPDF_FFLDraw
+* Render FormFeilds on a page to a device independent bitmap.
+* Parameters:
+* hHandle - Handle to the form fill module. Returned by FPDFDOC_InitFormFillEnvironment.
+* bitmap - Handle to the device independent bitmap (as the output buffer).
+* Bitmap handle can be created by FPDFBitmap_Create function.
+* page - Handle to the page. Returned by FPDF_LoadPage function.
+* start_x - Left pixel position of the display area in the device coordinate.
+* start_y - Top pixel position of the display area in the device coordinate.
+* size_x - Horizontal size (in pixels) for displaying the page.
+* size_y - Vertical size (in pixels) for displaying the page.
+* rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+* 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+* flags - 0 for normal display, or combination of flags defined above.
+* Return Value:
+* None.
+* Comments:
+* This method is designed to only render annotations and FormFields on the page.
+* Without FPDF_ANNOT specified for flags, Rendering functions such as FPDF_RenderPageBitmap or FPDF_RenderPageBitmap_Start will only render page contents(without annotations) to a bitmap.
+* In order to implement the FormFill functions,Implementation should call this method after rendering functions finish rendering the page contents.
+**/
+DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y,
+ int size_x, int size_y, int rotate, int flags);
+/**
+ * Function: FPDF_HasXFAField
+ * This method is designed to check whether a pdf document has XFA fields.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * docType - Document type defined as DOCTYPE_xxx.
+ * Return Value:
+ * TRUE indicates that the input document has XFA fields, otherwise FALSE.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, int& docType);
+
+/**
+ * Function: FPDF_LoadXFA
+ * If the document consists of XFA fields, there should call this method to load XFA fields.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * Return Value:
+ * TRUE indicates success,otherwise FALSE.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document);
+
+/**
+ * Function: FPDF_Widget_Undo
+ * This method will implement the undo feature for the specified xfa field.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * hWidget - Handle to the xfa field.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, FPDF_WIDGET hWidget);
+/**
+ * Function: FPDF_Widget_Redo
+ * This method will implement the redo feature for the specified xfa field.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * hWidget - Handle to the xfa field.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, FPDF_WIDGET hWidget);
+/**
+ * Function: FPDF_Widget_SelectAll
+ * This method will implement the select all feature for the specified xfa field.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * hWidget - Handle to the xfa field.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, FPDF_WIDGET hWidget);
+/**
+ * Function: FPDF_Widget_Copy
+ * This method will implement the copy feature for the specified xfa field.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * hWidget - Handle to the xfa field.
+ * wsText - Pointer to data buffer to receive the copied data, in UTF-16LE format.
+ * size - The data buffer size.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, FPDF_WIDESTRING wsText, FPDF_DWORD* size);
+/**
+ * Function: FPDF_Widget_Cut
+ * This method will implement the cut feature for the specified xfa field.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * hWidget - Handle to the xfa field.
+ * wsText - Pointer to data buffer to receive the cut data,in UTF-16LE format.
+ * size - The data buffer size,not the byte number.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, FPDF_WIDESTRING wsText, FPDF_DWORD* size);
+/**
+ * Function: FPDF_Widget_Paste
+ * This method will implement the paste feature for the specified xfa field.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * hWidget - Handle to the xfa field.
+ * wsText - The paste text buffer, in UTF-16LE format.
+ * size - The data buffer size,not the byte number.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, FPDF_WIDESTRING wsText, FPDF_DWORD size);
+/**
+ * Function: FPDF_Widget_ReplaceSpellCheckWord
+ * This method will implement the spell check feature for the specified xfa field.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * hWidget - Handle to the xfa field.
+ * x - The x value of the specified point.
+ * y - The y value of the specified point.
+ * bsText - The text buffer needed to be speck check, in UTF-16LE format.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT void STDCALL FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, float x, float y, FPDF_BYTESTRING bsText);
+/**
+ * Function: FPDF_Widget_GetSpellCheckWords
+ * This method will implement the spell check feature for the specified xfa field.
+ * Parameters:
+ * document - Handle to document. Returned by FPDF_LoadDocument function.
+ * hWidget - Handle to the xfa field.
+ * x - The x value of the specified point.
+ * y - The y value of the specified point.
+ * stringHandle - Pointer to FPDF_STRINGHANDLE to receive the speck check text buffer, in UTF-16LE format.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT void STDCALL FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, FPDF_WIDGET hWidget, float x, float y, FPDF_STRINGHANDLE* stringHandle);
+/**
+ * Function: FPDF_StringHandleCounts
+ * This method will get the count of the text buffer.
+ * Parameters:
+ * stringHandle - Pointer to FPDF_STRINGHANDLE.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT int STDCALL FPDF_StringHandleCounts(FPDF_STRINGHANDLE stringHandle);
+/**
+ * Function: FPDF_StringHandleGetStringByIndex
+ * This method will get the specified index of the text buffer.
+ * Parameters:
+ * stringHandle - Pointer to FPDF_STRINGHANDLE.
+ * index - The specified index of text buffer.
+ * bsText - Pointer to data buffer to receive the text buffer, in UTF-16LE format.
+ * size - The byte size of data buffer.
+ * Return Value:
+ * TRUE indicates success, otherwise FALSE.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE stringHandle, int index, FPDF_BYTESTRING bsText, FPDF_DWORD* size);
+/**
+ * Function: FPDF_StringHandleRelease
+ * This method will release the FPDF_STRINGHANDLE.
+ * Parameters:
+ * stringHandle - Pointer to FPDF_STRINGHANDLE.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT void STDCALL FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle);
+/**
+ * Function: FPDF_StringHandleAddString
+ * This method will add the specified text buffer.
+ * Parameters:
+ * stringHandle - Pointer to FPDF_STRINGHANDLE.
+ * bsText - Pointer to data buffer of the text buffer, in UTF-16LE format.
+ * size - The byte size of data buffer.
+ * Return Value:
+ * TRUE indicates success, otherwise FALSE.
+ **/
+DLLEXPORT FPDF_BOOL STDCALL FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, FPDF_BYTESTRING bsText, FPDF_DWORD size);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif //_FPDFORMFILL_H
+
diff --git a/public/fpdf_fwlevent.h b/public/fpdf_fwlevent.h
new file mode 100644
index 0000000000..f77e7e399f
--- /dev/null
+++ b/public/fpdf_fwlevent.h
@@ -0,0 +1,286 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FWL_EVENT_H
+#define _FWL_EVENT_H
+
+#include "fpdfview.h"
+
+typedef int FPDF_INT32;
+typedef unsigned int FPDF_UINT32;
+typedef float FPDF_FLOAT;
+//event type
+typedef enum
+{
+ FWL_EVENTTYPE_Mouse = 0 ,
+ FWL_EVENTTYPE_MouseWheel,
+ FWL_EVENTTYPE_Key ,
+} FWL_EVENTTYPE;
+
+//key flag
+typedef enum
+{
+ FWL_EVENTFLAG_ShiftKey = 1 << 0,
+ FWL_EVENTFLAG_ControlKey = 1 << 1,
+ FWL_EVENTFLAG_AltKey = 1 << 2,
+ FWL_EVENTFLAG_MetaKey = 1 << 3,
+ FWL_EVENTFLAG_KeyPad = 1 << 4,
+ FWL_EVENTFLAG_AutoRepeat = 1 << 5,
+ FWL_EVENTFLAG_LeftButtonDown = 1 << 6,
+ FWL_EVENTFLAG_MiddleButtonDown = 1 << 7,
+ FWL_EVENTFLAG_RightButtonDown = 1 << 8,
+} FWL_EVENTFLAG;
+
+// Mouse message command
+typedef enum
+{
+ FWL_EVENTMOUSECMD_LButtonDown = 1 ,
+ FWL_EVENTMOUSECMD_LButtonUp ,
+ FWL_EVENTMOUSECMD_LButtonDblClk ,
+ FWL_EVENTMOUSECMD_RButtonDown ,
+ FWL_EVENTMOUSECMD_RButtonUp ,
+ FWL_EVENTMOUSECMD_RButtonDblClk ,
+ FWL_EVENTMOUSECMD_MButtonDown ,
+ FWL_EVENTMOUSECMD_MButtonUp ,
+ FWL_EVENTMOUSECMD_MButtonDblClk ,
+ FWL_EVENTMOUSECMD_MouseMove ,
+ FWL_EVENTMOUSECMD_MouseEnter ,
+ FWL_EVENTMOUSECMD_MouseHover ,
+ FWL_EVENTMOUSECMD_MouseLeave ,
+} FWL_EVENT_MOUSECMD;
+
+//mouse event
+struct FWL_EVENT_MOUSE
+{
+ FPDF_UINT32 command;
+ FPDF_DWORD flag;
+ FPDF_FLOAT x;
+ FPDF_FLOAT y;
+};
+
+//mouse wheel
+struct FWL_EVENT_MOUSEWHEEL
+{
+ FPDF_DWORD flag;
+ FPDF_FLOAT x;
+ FPDF_FLOAT y;
+ FPDF_FLOAT deltaX;
+ FPDF_FLOAT deltaY;
+};
+
+//virtual keycode
+typedef enum
+{
+ FWL_VKEY_Back = 0x08,
+ FWL_VKEY_Tab = 0x09,
+ FWL_VKEY_Clear = 0x0C,
+ FWL_VKEY_Return = 0x0D,
+ FWL_VKEY_Shift = 0x10,
+ FWL_VKEY_Control = 0x11,
+ FWL_VKEY_Menu = 0x12,
+ FWL_VKEY_Pause = 0x13,
+ FWL_VKEY_Capital = 0x14,
+ FWL_VKEY_Kana = 0x15,
+ FWL_VKEY_Hangul = 0x15,
+ FWL_VKEY_Junja = 0x17,
+ FWL_VKEY_Final = 0x18,
+ FWL_VKEY_Hanja = 0x19,
+ FWL_VKEY_Kanji = 0x19,
+ FWL_VKEY_Escape = 0x1B,
+ FWL_VKEY_Convert = 0x1C,
+ FWL_VKEY_NonConvert = 0x1D,
+ FWL_VKEY_Accept = 0x1E,
+ FWL_VKEY_ModeChange = 0x1F,
+ FWL_VKEY_Space = 0x20,
+ FWL_VKEY_Prior = 0x21,
+ FWL_VKEY_Next = 0x22,
+ FWL_VKEY_End = 0x23,
+ FWL_VKEY_Home = 0x24,
+ FWL_VKEY_Left = 0x25,
+ FWL_VKEY_Up = 0x26,
+ FWL_VKEY_Right = 0x27,
+ FWL_VKEY_Down = 0x28,
+ FWL_VKEY_Select = 0x29,
+ FWL_VKEY_Print = 0x2A,
+ FWL_VKEY_Execute = 0x2B,
+ FWL_VKEY_Snapshot = 0x2C,
+ FWL_VKEY_Insert = 0x2D,
+ FWL_VKEY_Delete = 0x2E,
+ FWL_VKEY_Help = 0x2F,
+ FWL_VKEY_0 = 0x30,
+ FWL_VKEY_1 = 0x31,
+ FWL_VKEY_2 = 0x32,
+ FWL_VKEY_3 = 0x33,
+ FWL_VKEY_4 = 0x34,
+ FWL_VKEY_5 = 0x35,
+ FWL_VKEY_6 = 0x36,
+ FWL_VKEY_7 = 0x37,
+ FWL_VKEY_8 = 0x38,
+ FWL_VKEY_9 = 0x39,
+ FWL_VKEY_A = 0x41,
+ FWL_VKEY_B = 0x42,
+ FWL_VKEY_C = 0x43,
+ FWL_VKEY_D = 0x44,
+ FWL_VKEY_E = 0x45,
+ FWL_VKEY_F = 0x46,
+ FWL_VKEY_G = 0x47,
+ FWL_VKEY_H = 0x48,
+ FWL_VKEY_I = 0x49,
+ FWL_VKEY_J = 0x4A,
+ FWL_VKEY_K = 0x4B,
+ FWL_VKEY_L = 0x4C,
+ FWL_VKEY_M = 0x4D,
+ FWL_VKEY_N = 0x4E,
+ FWL_VKEY_O = 0x4F,
+ FWL_VKEY_P = 0x50,
+ FWL_VKEY_Q = 0x51,
+ FWL_VKEY_R = 0x52,
+ FWL_VKEY_S = 0x53,
+ FWL_VKEY_T = 0x54,
+ FWL_VKEY_U = 0x55,
+ FWL_VKEY_V = 0x56,
+ FWL_VKEY_W = 0x57,
+ FWL_VKEY_X = 0x58,
+ FWL_VKEY_Y = 0x59,
+ FWL_VKEY_Z = 0x5A,
+ FWL_VKEY_LWin = 0x5B,
+ FWL_VKEY_Command = 0x5B,
+ FWL_VKEY_RWin = 0x5C,
+ FWL_VKEY_Apps = 0x5D,
+ FWL_VKEY_Sleep = 0x5F,
+ FWL_VKEY_NumPad0 = 0x60,
+ FWL_VKEY_NumPad1 = 0x61,
+ FWL_VKEY_NumPad2 = 0x62,
+ FWL_VKEY_NumPad3 = 0x63,
+ FWL_VKEY_NumPad4 = 0x64,
+ FWL_VKEY_NumPad5 = 0x65,
+ FWL_VKEY_NumPad6 = 0x66,
+ FWL_VKEY_NumPad7 = 0x67,
+ FWL_VKEY_NumPad8 = 0x68,
+ FWL_VKEY_NumPad9 = 0x69,
+ FWL_VKEY_Multiply = 0x6A,
+ FWL_VKEY_Add = 0x6B,
+ FWL_VKEY_Separator = 0x6C,
+ FWL_VKEY_Subtract = 0x6D,
+ FWL_VKEY_Decimal = 0x6E,
+ FWL_VKEY_Divide = 0x6F,
+ FWL_VKEY_F1 = 0x70,
+ FWL_VKEY_F2 = 0x71,
+ FWL_VKEY_F3 = 0x72,
+ FWL_VKEY_F4 = 0x73,
+ FWL_VKEY_F5 = 0x74,
+ FWL_VKEY_F6 = 0x75,
+ FWL_VKEY_F7 = 0x76,
+ FWL_VKEY_F8 = 0x77,
+ FWL_VKEY_F9 = 0x78,
+ FWL_VKEY_F10 = 0x79,
+ FWL_VKEY_F11 = 0x7A,
+ FWL_VKEY_F12 = 0x7B,
+ FWL_VKEY_F13 = 0x7C,
+ FWL_VKEY_F14 = 0x7D,
+ FWL_VKEY_F15 = 0x7E,
+ FWL_VKEY_F16 = 0x7F,
+ FWL_VKEY_F17 = 0x80,
+ FWL_VKEY_F18 = 0x81,
+ FWL_VKEY_F19 = 0x82,
+ FWL_VKEY_F20 = 0x83,
+ FWL_VKEY_F21 = 0x84,
+ FWL_VKEY_F22 = 0x85,
+ FWL_VKEY_F23 = 0x86,
+ FWL_VKEY_F24 = 0x87,
+ FWL_VKEY_NunLock = 0x90,
+ FWL_VKEY_Scroll = 0x91,
+ FWL_VKEY_LShift = 0xA0,
+ FWL_VKEY_RShift = 0xA1,
+ FWL_VKEY_LControl = 0xA2,
+ FWL_VKEY_RControl = 0xA3,
+ FWL_VKEY_LMenu = 0xA4,
+ FWL_VKEY_RMenu = 0xA5,
+ FWL_VKEY_BROWSER_Back = 0xA6,
+ FWL_VKEY_BROWSER_Forward = 0xA7,
+ FWL_VKEY_BROWSER_Refresh = 0xA8,
+ FWL_VKEY_BROWSER_Stop = 0xA9,
+ FWL_VKEY_BROWSER_Search = 0xAA,
+ FWL_VKEY_BROWSER_Favorites = 0xAB,
+ FWL_VKEY_BROWSER_Home = 0xAC,
+ FWL_VKEY_VOLUME_Mute = 0xAD,
+ FWL_VKEY_VOLUME_Down = 0xAE,
+ FWL_VKEY_VOLUME_Up = 0xAF,
+ FWL_VKEY_MEDIA_NEXT_Track = 0xB0,
+ FWL_VKEY_MEDIA_PREV_Track = 0xB1,
+ FWL_VKEY_MEDIA_Stop = 0xB2,
+ FWL_VKEY_MEDIA_PLAY_Pause = 0xB3,
+ FWL_VKEY_MEDIA_LAUNCH_Mail = 0xB4,
+ FWL_VKEY_MEDIA_LAUNCH_MEDIA_Select = 0xB5,
+ FWL_VKEY_MEDIA_LAUNCH_APP1 = 0xB6,
+ FWL_VKEY_MEDIA_LAUNCH_APP2 = 0xB7,
+ FWL_VKEY_OEM_1 = 0xBA,
+ FWL_VKEY_OEM_Plus = 0xBB,
+ FWL_VKEY_OEM_Comma = 0xBC,
+ FWL_VKEY_OEM_Minus = 0xBD,
+ FWL_VKEY_OEM_Period = 0xBE,
+ FWL_VKEY_OEM_2 = 0xBF,
+ FWL_VKEY_OEM_3 = 0xC0,
+ FWL_VKEY_OEM_4 = 0xDB,
+ FWL_VKEY_OEM_5 = 0xDC,
+ FWL_VKEY_OEM_6 = 0xDD,
+ FWL_VKEY_OEM_7 = 0xDE,
+ FWL_VKEY_OEM_8 = 0xDF,
+ FWL_VKEY_OEM_102 = 0xE2,
+ FWL_VKEY_ProcessKey = 0xE5,
+ FWL_VKEY_Packet = 0xE7,
+ FWL_VKEY_Attn = 0xF6,
+ FWL_VKEY_Crsel = 0xF7,
+ FWL_VKEY_Exsel = 0xF8,
+ FWL_VKEY_Ereof = 0xF9,
+ FWL_VKEY_Play = 0xFA,
+ FWL_VKEY_Zoom = 0xFB,
+ FWL_VKEY_NoName = 0xFC,
+ FWL_VKEY_PA1 = 0xFD,
+ FWL_VKEY_OEM_Clear = 0xFE,
+ FWL_VKEY_Unknown = 0,
+} FWL_VKEYCODE;
+
+//key event command
+typedef enum
+{
+ FWL_EVENTKEYCMD_KeyDown = 1 ,
+ FWL_EVENTKEYCMD_KeyUp ,
+ FWL_EVENTKEYCMD_Char ,
+} FWL_EVENTKEYCMD;
+
+//key event
+struct FWL_EVENT_KEY
+{
+ FPDF_UINT32 command;
+ FPDF_DWORD flag;
+ union
+ {
+ //Virtual key code.
+ FPDF_UINT32 vkcode;
+ //Character code.
+ FPDF_DWORD charcode;
+ }code;
+};
+
+//event type
+struct FWL_EVENT
+{
+ //structure size.
+ FPDF_UINT32 size;
+ //FWL_EVENTTYPE.
+ FPDF_UINT32 type;
+ union
+ {
+ struct FWL_EVENT_MOUSE mouse;
+ struct FWL_EVENT_MOUSEWHEEL wheel;
+ struct FWL_EVENT_KEY key;
+ }s;
+};
+
+#endif //_FWL_EVENT_H
+
+
diff --git a/public/fpdf_ppo.h b/public/fpdf_ppo.h
new file mode 100644
index 0000000000..db78a1942d
--- /dev/null
+++ b/public/fpdf_ppo.h
@@ -0,0 +1,46 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDFPPO_H_
+#define _FPDFPPO_H_
+
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDF_ImportPages
+// Import some pages to a PDF document.
+// Parameters:
+// dest_doc - The destination document which add the pages.
+// src_doc - A document to be imported.
+// pagerange - A page range string, Such as "1,3,5-7".
+// If this parameter is NULL, it would import all pages in src_doc.
+// index - The page index wanted to insert from.
+// Return value:
+// TRUE for succeed, FALSE for Failed.
+// Notes:
+// The method not support this feature for the document consists of dynamic XFA fields.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,FPDF_DOCUMENT src_doc, FPDF_BYTESTRING pagerange, int index);
+
+
+// Function: FPDF_CopyViewerPreferences
+// Copy the viewer preferences from one PDF document to another.#endif
+// Parameters:
+// dest_doc - Handle to document to write the viewer preferences to.
+// src_doc - Handle to document with the viewer preferences.
+// Return value:
+// TRUE for success, FALSE for failure.
+DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif //_FPDFPPO_H_
+
diff --git a/public/fpdf_progressive.h b/public/fpdf_progressive.h
new file mode 100644
index 0000000000..69bbfba4cd
--- /dev/null
+++ b/public/fpdf_progressive.h
@@ -0,0 +1,102 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDF_PROGRESSIVE_H_
+#define _FPDF_PROGRESSIVE_H_
+
+#include "fpdfview.h"
+
+//Flags for progressive process status.
+#define FPDF_RENDER_READER 0
+#define FPDF_RENDER_TOBECOUNTINUED 1
+#define FPDF_RENDER_DONE 2
+#define FPDF_RENDER_FAILED 3
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//IFPDF_RENDERINFO interface.
+typedef struct _IFSDK_PAUSE
+{
+ /**
+ * Version number of the interface. Currently must be 1.
+ **/
+ int version;
+
+ /*
+ * Method: NeedToPauseNow
+ * Check if we need to pause a progressive process now.
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * Return Value:
+ * Non-zero for pause now, 0 for continue.
+ *
+ */
+ FPDF_BOOL (*NeedToPauseNow) (struct _IFSDK_PAUSE* pThis);
+
+ //A user defined data pointer, used by user's application. Can be NULL.
+ void* user;
+} IFSDK_PAUSE;
+
+// Function: FPDF_RenderPageBitmap_Start
+// Start to render page contents to a device independent bitmap progressively.
+// Parameters:
+// bitmap - Handle to the device independent bitmap (as the output buffer).
+// Bitmap handle can be created by FPDFBitmap_Create function.
+// page - Handle to the page. Returned by FPDF_LoadPage function.
+// start_x - Left pixel position of the display area in the bitmap coordinate.
+// start_y - Top pixel position of the display area in the bitmap coordinate.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+// flags - 0 for normal display, or combination of flags defined above.
+// pause - The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process
+// Return value:
+// Rendering Status. See flags for progressive process status for the details.
+// Notes:
+// The method cannot not support to render page which the document consists of dynamic XFA fields.
+//
+DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x,
+ int size_y, int rotate, int flags,IFSDK_PAUSE * pause);
+
+// Function: FPDF_RenderPage_Continue
+// Continue rendering a PDF page.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage function.
+// pause - The IFSDK_PAUSE interface.A callback mechanism allowing the page rendering process
+// to be paused before it's finished. This can be NULL if you don't want to pause.
+// Return value:
+// The rendering status. See flags for progressive process status for the details.
+// Notes:
+// The method cannot not support to render page which the document consists of dynamic XFA fields.
+//
+DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,IFSDK_PAUSE * pause);
+
+// Function: FPDF_RenderPage_Close
+// Release the resource allocate during page rendering. Need to be called after finishing rendering or
+// cancel the rendering.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage function.
+// Return value:
+// NULL
+// Notes:
+// The method cannot not support to render page which the document consists of dynamic XFA fields.
+//
+DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //_FPDF_PROGRESSIVE_H_
diff --git a/public/fpdf_save.h b/public/fpdf_save.h
new file mode 100644
index 0000000000..0909d5a447
--- /dev/null
+++ b/public/fpdf_save.h
@@ -0,0 +1,82 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDFSAVE_H_
+#define _FPDFSAVE_H_
+
+#include "fpdfview.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+// Structure for custom file write
+struct FPDF_FILEWRITE{
+
+ //
+ //Version number of the interface. Currently must be 1.
+ //
+ int version;
+
+ //
+ // Method: WriteBlock
+ // Output a block of data in your custom way.
+ // Interface Version:
+ // 1
+ // Implementation Required:
+ // Yes
+ // Comments:
+ // Called by function FPDF_SaveDocument
+ // Parameters:
+ // pThis - Pointer to the structure itself
+ // pData - Pointer to a buffer to output
+ // size - The size of the buffer.
+ // Return value:
+ // Should be non-zero if successful, zero for error.
+ //
+ int (*WriteBlock)( FPDF_FILEWRITE* pThis, const void* pData, unsigned long size);
+
+};
+
+
+/** @brief Incremental. */
+#define FPDF_INCREMENTAL 1
+/** @brief No Incremental. */
+#define FPDF_NO_INCREMENTAL 2
+/** @brief Remove security. */
+#define FPDF_REMOVE_SECURITY 3
+
+// Function: FPDF_SaveAsCopy
+// Saves the copy of specified document in custom way.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument.
+// pFileWrite - A pointer to a custom file write structure.
+// flags - The creating flags.
+// Return value:
+// TRUE for succeed, FALSE for failed.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy( FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
+ FPDF_DWORD flags );
+
+// Function: FPDF_SaveWithVersion
+// Same as function ::FPDF_SaveAsCopy, except the file version of the saved document could be specified by user.
+// Parameters:
+// document - Handle to document.
+// pFileWrite - A pointer to a custom file write structure.
+// flags - The creating flags.
+// fileVersion - The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...
+// Return value:
+// TRUE if succeed, FALSE if failed.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,FPDF_FILEWRITE * pFileWrite,
+ FPDF_DWORD flags, int fileVersion);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif //_FPDFSAVE_H_
diff --git a/public/fpdf_searchex.h b/public/fpdf_searchex.h
new file mode 100644
index 0000000000..d70dddc984
--- /dev/null
+++ b/public/fpdf_searchex.h
@@ -0,0 +1,33 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDF_SEARCH_EX_H
+#define _FPDF_SEARCH_EX_H
+
+#ifndef _FPDFVIEW_H_
+#include "fpdfview.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDFText_GetCharIndexFromTextIndex
+// Get the actually char index in text_page's internal char list.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// nTextIndex - The index of the text in the string get from FPDFText_GetText.
+// Return value:
+// The index of the character in internal charlist. -1 for error.
+DLLEXPORT int STDCALL FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex);
+
+#ifdef __cplusplus
+};
+#endif
+
+
+#endif
+
diff --git a/public/fpdf_sysfontinfo.h b/public/fpdf_sysfontinfo.h
new file mode 100644
index 0000000000..00c9fab0e6
--- /dev/null
+++ b/public/fpdf_sysfontinfo.h
@@ -0,0 +1,241 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDF_SYSFONTINFO_H
+#define _FPDF_SYSFONTINFO_H
+
+#include "fpdfview.h"
+
+/* Character sets for the font */
+#define FXFONT_ANSI_CHARSET 0
+#define FXFONT_DEFAULT_CHARSET 1
+#define FXFONT_SYMBOL_CHARSET 2
+#define FXFONT_SHIFTJIS_CHARSET 128
+#define FXFONT_HANGEUL_CHARSET 129
+#define FXFONT_GB2312_CHARSET 134
+#define FXFONT_CHINESEBIG5_CHARSET 136
+
+/* Font pitch and family flags */
+#define FXFONT_FF_FIXEDPITCH 1
+#define FXFONT_FF_ROMAN (1<<4)
+#define FXFONT_FF_SCRIPT (4<<4)
+
+/* Typical weight values */
+#define FXFONT_FW_NORMAL 400
+#define FXFONT_FW_BOLD 700
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * Interface: FPDF_SYSFONTINFO
+ * Interface for getting system font information and font mapping
+ */
+typedef struct _FPDF_SYSFONTINFO {
+ /**
+ * Version number of the interface. Currently must be 1.
+ **/
+ int version;
+
+ /**
+ * Method: Release
+ * Give implementation a chance to release any data after the interface is no longer used
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * No
+ * Comments:
+ * Called by Foxit SDK during the final cleanup process.
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * Return Value:
+ * None
+ */
+ void (*Release)(struct _FPDF_SYSFONTINFO* pThis);
+
+ /**
+ * Method: EnumFonts
+ * Enumerate all fonts installed on the system
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * No
+ * Comments:
+ * Implementation should call FPDF_AddIntalledFont() function for each font found.
+ * Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK.
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * pMapper - An opaque pointer to internal font mapper, used when calling FPDF_AddInstalledFont
+ * Return Value:
+ * None
+ */
+ void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper);
+
+ /**
+ * Method: MapFont
+ * Use the system font mapper to get a font handle from requested parameters
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * Yes only if GetFont method is not implemented.
+ * Comments:
+ * If the system supports native font mapper (like Windows), implementation can implement this method to get a font handle.
+ * Otherwise, Foxit SDK will do the mapping and then call GetFont method.
+ * Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK.
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * weight - Weight of the requested font. 400 is normal and 700 is bold.
+ * bItalic - Italic option of the requested font, TRUE or FALSE.
+ * charset - Character set identifier for the requested font. See above defined constants.
+ * pitch_family - A combination of flags. See above defined constants.
+ * face - Typeface name. Currently use system local encoding only.
+ * bExact - Pointer to an boolean value receiving the indicator whether mapper found the exact match.
+ * If mapper is not sure whether it's exact match, ignore this paramter.
+ * Return Value:
+ * An opaque pointer for font handle, or NULL if system mapping is not supported.
+ **/
+ void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis, int weight, int bItalic, int charset, int pitch_family,
+ const char* face, int* bExact);
+
+ /**
+ * Method: GetFont
+ * Get a handle to a particular font by its internal ID
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * Yes only if MapFont method is not implemented.
+ * Comments:
+ * If the system mapping not supported, Foxit SDK will do the font mapping and use this method to get a font handle.
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * face - Typeface name. Currently use system local encoding only.
+ * Return Value:
+ * An opaque pointer for font handle.
+ **/
+ void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face);
+
+ /**
+ * Method: GetFontData
+ * Get font data from a font
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * Yes
+ * Comments:
+ * Can read either full font file, or a particular TrueType/OpenType table
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * hFont - Font handle returned by MapFont or GetFont method
+ * table - TrueType/OpenType table identifier (refer to TrueType specification).
+ * 0 for the whole font file.
+ * buffer - The buffer receiving the font data. Can be NULL if not provided
+ * buf_size - Buffer size, can be zero if not provided
+ * Return Value:
+ * Number of bytes needed, if buffer not provided or not large enough,
+ * or number of bytes written into buffer otherwise.
+ **/
+ unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis, void* hFont,
+ unsigned int table, unsigned char* buffer, unsigned long buf_size);
+
+ /**
+ * Method: GetFaceName
+ * Get face name from a font handle
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * No
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * hFont - Font handle returned by MapFont or GetFont method
+ * buffer - The buffer receiving the face name. Can be NULL if not provided
+ * buf_size - Buffer size, can be zero if not provided
+ * Return Value:
+ * Number of bytes needed, if buffer not provided or not large enough,
+ * or number of bytes written into buffer otherwise.
+ **/
+ unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis, void* hFont, char* buffer, unsigned long buf_size);
+
+ /**
+ * Method: GetFontCharset
+ * Get character set information for a font handle
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * No
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * hFont - Font handle returned by MapFont or GetFont method
+ * Return Value:
+ * Character set identifier. See defined constants above.
+ **/
+ int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
+
+ /**
+ * Method: DeleteFont
+ * Delete a font handle
+ * Interface Version:
+ * 1
+ * Implementation Required:
+ * Yes
+ * Parameters:
+ * pThis - Pointer to the interface structure itself
+ * hFont - Font handle returned by MapFont or GetFont method
+ * Return Value:
+ * None
+ **/
+ void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
+} FPDF_SYSFONTINFO;
+
+/**
+ * Function: FPDF_AddInstalledFont
+ * Add a system font to the list in Foxit SDK.
+ * Comments:
+ * This function is only called during the system font list building process.
+ * Parameters:
+ * mapper - Opaque pointer to Foxit font mapper
+ * face - The font face name
+ * charset - Font character set. See above defined constants.
+ * Return Value:
+ * None.
+ **/
+DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, const char* face, int charset);
+
+/**
+ * Function: FPDF_SetSystemFontInfo
+ * Set the system font info interface into Foxit SDK
+ * Comments:
+ * Platform support implementation should implement required methods of FFDF_SYSFONTINFO interface,
+ * then call this function during SDK initialization process.
+ * Parameters:
+ * pFontInfo - Pointer to a FPDF_SYSFONTINFO structure
+ * Return Value:
+ * None
+ **/
+DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
+
+/**
+ * Function: FPDF_GetDefaultSystemFontInfo
+ * Get default system font info interface for current platform
+ * Comments:
+ * For some platforms Foxit SDK implement a default version of system font info interface.
+ * The default implementation can be used in FPDF_SetSystemFontInfo function.
+ * Parameters:
+ * None
+ * Return Value:
+ * Pointer to a FPDF_SYSFONTINFO structure describing the default interface.
+ * Or NULL if the platform doesn't have a default interface.
+ * Application should call FPDF_FreeMemory to free the returned pointer.
+ **/
+DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo();
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // _FPDF_SYSFONTINFO_H
diff --git a/public/fpdf_text.h b/public/fpdf_text.h
new file mode 100644
index 0000000000..cd33f2d061
--- /dev/null
+++ b/public/fpdf_text.h
@@ -0,0 +1,322 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDFTEXT_H_
+#define _FPDFTEXT_H_
+
+#include "fpdfview.h"
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDFText_LoadPage
+// Prepare information about all characters in a page.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage function (in FPDFVIEW module).
+// Return value:
+// A handle to the text page information structure.
+// NULL if something goes wrong.
+// Comments:
+// Application must call FPDFText_ClosePage to release the text page information.
+// Notes:
+// The method can not support to load out FPDF_TEXTPAGE for the document consists of dynamic fields.
+//
+DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page);
+
+// Function: FPDFText_ClosePage
+// Release all resources allocated for a text page information structure.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// Return Value:
+// None.
+//
+DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
+
+// Function: FPDFText_CountChars
+// Get number of characters in a page.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// Return value:
+// Number of characters in the page. Return -1 for error.
+// Generated characters, like additional space characters, new line characters, are also counted.
+// Comments:
+// Characters in a page form a "stream", inside the stream, each character has an index.
+// We will use the index parameters in many of FPDFTEXT functions. The first character in the page
+// has an index value of zero.
+//
+DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page);
+
+// Function: FPDFText_GetUnicode
+// Get Unicode of a character in a page.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// Return value:
+// The Unicode of the particular character.
+// If a character is not encoded in Unicode and Foxit engine can't convert to Unicode,
+// the return value will be zero.
+//
+DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index);
+
+// Function: FPDFText_GetFontSize
+// Get the font size of a particular character.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// Return value:
+// The font size of the particular character, measured in points (about 1/72 inch).
+// This is the typographic size of the font (so called "em size").
+//
+DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, int index);
+
+// Function: FPDFText_GetCharBox
+// Get bounding box of a particular character.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// index - Zero-based index of the character.
+// left - Pointer to a double number receiving left position of the character box.
+// right - Pointer to a double number receiving right position of the character box.
+// bottom - Pointer to a double number receiving bottom position of the character box.
+// top - Pointer to a double number receiving top position of the character box.
+// Return Value:
+// None.
+// Comments:
+// All positions are measured in PDF "user space".
+//
+DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, int index, double* left,
+ double* right, double* bottom, double* top);
+
+// Function: FPDFText_GetCharIndexAtPos
+// Get the index of a character at or nearby a certain position on the page.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// x - X position in PDF "user space".
+// y - Y position in PDF "user space".
+// xTolerance - An x-axis tolerance value for character hit detection, in point unit.
+// yTolerance - A y-axis tolerance value for character hit detection, in point unit.
+// Return Value:
+// The zero-based index of the character at, or nearby the point (x,y).
+// If there is no character at or nearby the point, return value will be -1.
+// If an error occurs, -3 will be returned.
+//
+DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
+ double x, double y, double xTorelance, double yTolerance);
+
+// Function: FPDFText_GetText
+// Extract unicode text string from the page.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// start_index - Index for the start characters.
+// count - Number of characters to be extracted.
+// result - A buffer (allocated by application) receiving the extracted unicodes.
+// The size of the buffer must be able to hold the number of characters plus a terminator.
+// Return Value:
+// Number of characters written into the result buffer, including the trailing terminator.
+// Comments:
+// This function ignores characters without unicode information.
+//
+DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, int start_index, int count, unsigned short* result);
+
+// Function: FPDFText_CountRects
+// Count number of rectangular areas occupied by a segment of texts.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// start_index - Index for the start characters.
+// count - Number of characters.
+// Return value:
+// Number of rectangles. Zero for error.
+// Comments:
+// This function, along with FPDFText_GetRect can be used by applications to detect the position
+// on the page for a text segment, so proper areas can be highlighted or something.
+// FPDFTEXT will automatically merge small character boxes into bigger one if those characters
+// are on the same line and use same font settings.
+//
+DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, int start_index, int count);
+
+// Function: FPDFText_GetRect
+// Get a rectangular area from the result generated by FPDFText_CountRects.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// rect_index - Zero-based index for the rectangle.
+// left - Pointer to a double value receiving the rectangle left boundary.
+// top - Pointer to a double value receiving the rectangle top boundary.
+// right - Pointer to a double value receiving the rectangle right boundary.
+// bottom - Pointer to a double value receiving the rectangle bottom boundary.
+// Return Value:
+// None.
+//
+DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, int rect_index, double* left, double* top,
+ double* right, double* bottom);
+
+// Function: FPDFText_GetBoundedText
+// Extract unicode text within a rectangular boundary on the page.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// left - Left boundary.
+// top - Top boundary.
+// right - Right boundary.
+// bottom - Bottom boundary.
+// buffer - A unicode buffer.
+// buflen - Number of characters (not bytes) for the buffer, excluding an additional terminator.
+// Return Value:
+// If buffer is NULL or buflen is zero, return number of characters (not bytes) of text present within
+// the rectangle, excluding a terminating NUL. Generally you should pass a buffer at least one larger
+// than this if you want a terminating NUL, which will be provided if space is available.
+// Otherwise, return number of characters copied into the buffer, including the terminating NUL
+// when space for it is available.
+// Comment:
+// If the buffer is too small, as much text as will fit is copied into it.
+//
+DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double left, double top,
+ double right, double bottom,unsigned short* buffer,int buflen);
+
+
+// Flags used by FPDFText_FindStart function.
+#define FPDF_MATCHCASE 0x00000001 //If not set, it will not match case by default.
+#define FPDF_MATCHWHOLEWORD 0x00000002 //If not set, it will not match the whole word by default.
+
+// Function: FPDFText_FindStart
+// Start a search.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// findwhat - A unicode match pattern.
+// flags - Option flags.
+// start_index - Start from this character. -1 for end of the page.
+// Return Value:
+// A handle for the search context. FPDFText_FindClose must be called to release this handle.
+//
+DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, FPDF_WIDESTRING findwhat,
+ unsigned long flags, int start_index);
+
+// Function: FPDFText_FindNext
+// Search in the direction from page start to end.
+// Parameters:
+// handle - A search context handle returned by FPDFText_FindStart.
+// Return Value:
+// Whether a match is found.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_FindPrev
+// Search in the direction from page end to start.
+// Parameters:
+// handle - A search context handle returned by FPDFText_FindStart.
+// Return Value:
+// Whether a match is found.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_GetSchResultIndex
+// Get the starting character index of the search result.
+// Parameters:
+// handle - A search context handle returned by FPDFText_FindStart.
+// Return Value:
+// Index for the starting character.
+//
+DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_GetSchCount
+// Get the number of matched characters in the search result.
+// Parameters:
+// handle - A search context handle returned by FPDFText_FindStart.
+// Return Value:
+// Number of matched characters.
+//
+DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
+
+// Function: FPDFText_FindClose
+// Release a search context.
+// Parameters:
+// handle - A search context handle returned by FPDFText_FindStart.
+// Return Value:
+// None.
+//
+DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle);
+
+// Function: FPDFLink_LoadWebLinks
+// Prepare information about weblinks in a page.
+// Parameters:
+// text_page - Handle to a text page information structure. Returned by FPDFText_LoadPage function.
+// Return Value:
+// A handle to the page's links information structure.
+// NULL if something goes wrong.
+// Comments:
+// Weblinks are those links implicitly embedded in PDF pages. PDF also has a type of
+// annotation called "link", FPDFTEXT doesn't deal with that kind of link.
+// FPDFTEXT weblink feature is useful for automatically detecting links in the page
+// contents. For example, things like "http://www.foxitsoftware.com" will be detected,
+// so applications can allow user to click on those characters to activate the link,
+// even the PDF doesn't come with link annotations.
+//
+// FPDFLink_CloseWebLinks must be called to release resources.
+//
+DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
+
+// Function: FPDFLink_CountWebLinks
+// Count number of detected web links.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// Return Value:
+// Number of detected web links.
+//
+DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
+
+// Function: FPDFLink_GetURL
+// Fetch the URL information for a detected web link.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// link_index - Zero-based index for the link.
+// buffer - A unicode buffer.
+// buflen - Number of characters (not bytes) for the buffer, including an additional terminator.
+// Return Value:
+// If buffer is NULL or buflen is zero, return number of characters (not bytes and an additional terminator is also counted) needed,
+// otherwise, return number of characters copied into the buffer.
+//
+DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, int link_index, unsigned short* buffer,int buflen);
+
+// Function: FPDFLink_CountRects
+// Count number of rectangular areas for the link.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// link_index - Zero-based index for the link.
+// Return Value:
+// Number of rectangular areas for the link.
+//
+DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, int link_index);
+
+// Function: FPDFLink_GetRect
+// Fetch the boundaries of a rectangle for a link.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// link_index - Zero-based index for the link.
+// rect_index - Zero-based index for a rectangle.
+// left - Pointer to a double value receiving the rectangle left boundary.
+// top - Pointer to a double value receiving the rectangle top boundary.
+// right - Pointer to a double value receiving the rectangle right boundary.
+// bottom - Pointer to a double value receiving the rectangle bottom boundary.
+// Return Value:
+// None.
+//
+DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, int link_index, int rect_index,
+ double* left, double* top,double* right, double* bottom);
+
+// Function: FPDFLink_CloseWebLinks
+// Release resources used by weblink feature.
+// Parameters:
+// link_page - Handle returned by FPDFLink_LoadWebLinks.
+// Return Value:
+// None.
+//
+DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif//_FPDFTEXT_H_
diff --git a/public/fpdf_transformpage.h b/public/fpdf_transformpage.h
new file mode 100644
index 0000000000..32b0ea008c
--- /dev/null
+++ b/public/fpdf_transformpage.h
@@ -0,0 +1,118 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _TRANSFORMPAGE_H_
+#define _TRANSFORMPAGE_H_
+
+#ifndef _FPDFVIEW_H_
+#include "fpdfview.h"
+#endif
+
+typedef void* FPDF_PAGEARCSAVER;
+typedef void* FPDF_PAGEARCLOADER;
+/**
+* Set "MediaBox" entry to the page dictionary.
+* @param[in] page - Handle to a page.
+* @param[in] left - The left of the rectangle.
+* @param[in] bottom - The bottom of the rectangle.
+* @param[in] right - The right of the rectangle.
+* @param[in] top - The top of the rectangle.
+* @retval None.
+* @note The method can not support to set this feature for the document which consists of dynamic XFA fields.
+*/
+DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bottom, float right, float top);
+
+/**
+* Set "CropBox" entry to the page dictionary.
+* @param[in] page - Handle to a page.
+* @param[in] left - The left of the rectangle.
+* @param[in] bottom - The bottom of the rectangle.
+* @param[in] right - The right of the rectangle.
+* @param[in] top - The top of the rectangle.
+* @retval None.
+* @note The method can not support to set this feature for the document which consists of dynamic XFA fields.
+*/
+DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, float left, float bottom, float right, float top);
+
+
+/** Get "MediaBox" entry from the page dictionary.
+* @param[in] page - Handle to a page.
+* @param[in] left - Pointer to a double value receiving the left of the rectangle.
+* @param[in] bottom - Pointer to a double value receiving the bottom of the rectangle.
+* @param[in] right - Pointer to a double value receiving the right of the rectangle.
+* @param[in] top - Pointer to a double value receiving the top of the rectangle.
+* @retval True if success,else fail.
+* @note The method can not support to get this feature for the document which consists of dynamic XFA fields.
+*/
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
+
+/** Get "CropBox" entry from the page dictionary.
+* @param[in] page - Handle to a page.
+* @param[in] left - Pointer to a double value receiving the left of the rectangle.
+* @param[in] bottom - Pointer to a double value receiving the bottom of the rectangle.
+* @param[in] right - Pointer to a double value receiving the right of the rectangle.
+* @param[in] top - Pointer to a double value receiving the top of the rectangle.
+* @retval True if success,else fail.
+* @note The method can not support to get this feature for the document which consists of dynamic XFA fields.
+*/
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, float* left, float* bottom, float* right, float* top);
+
+/**
+* Transform the whole page with a specified matrix, then clip the page content region.
+*
+* @param[in] page - A page handle.
+* @param[in] matrix - The transform matrix.
+* @param[in] clipRect - A rectangle page area to be clipped.
+* @Note. This function will transform the whole page, and would take effect to all the objects in the page.
+* The method can not support to get this feature for the document which consists of dynamic XFA fields.
+*/
+DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX* matrix, FS_RECTF* clipRect);
+
+/**
+* Transform (scale, rotate, shear, move) the clip path of page object.
+* @param[in] page_object - Handle to a page object. Returned by FPDFPageObj_NewImageObj.
+* @param[in] a - The coefficient "a" of the matrix.
+* @param[in] b - The coefficient "b" of the matrix.
+* @param[in] c - The coefficient "c" of the matrix.
+* @param[in] d - The coefficient "d" of the matrix.
+* @param[in] e - The coefficient "e" of the matrix.
+* @param[in] f - The coefficient "f" of the matrix.
+* @retval None.
+*/
+DLLEXPORT void STDCALL FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,double a, double b, double c, double d, double e, double f);
+
+/**
+* Create a new clip path, with a rectangle inserted.
+*
+* @param[in] left - The left of the clip box.
+* @param[in] bottom - The bottom of the clip box.
+* @param[in] right - The right of the clip box.
+* @param[in] top - The top of the clip box.
+* @retval a handle to the clip path.
+*/
+DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, float bottom, float right, float top);
+
+/**
+* Destroy the clip path.
+*
+* @param[in] clipPath - A handle to the clip path.
+* Destroy the clip path.
+* @retval None.
+*/
+DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
+
+/**
+* Clip the page content, the page content that outside the clipping region become invisible.
+*
+* @param[in] page - A page handle.
+* @param[in] clipPath - A handle to the clip path.
+* @Note. A clip path will be inserted before the page content stream or content array. In this way, the page content will be clipped
+* by this clip path. The method can not support this feature for the document consists of dynamic XFA fields.
+*/
+DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clipPath);
+
+#endif
+
diff --git a/public/fpdfview.h b/public/fpdfview.h
new file mode 100644
index 0000000000..d0b745ccfa
--- /dev/null
+++ b/public/fpdfview.h
@@ -0,0 +1,776 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+// NOTE: External docs refer to this file as "fpdfview.h", so do not rename
+// despite lack of consitency with other public files.
+
+#ifndef _FPDFVIEW_H_
+#define _FPDFVIEW_H_
+
+#if defined(_WIN32) && !defined(__WINDOWS__)
+#include <windows.h>
+#endif
+
+// TODO: remove the #define when XFA is officially in pdfium
+#define PDF_USE_XFA
+
+// Data types
+typedef void* FPDF_MODULEMGR;
+
+// PDF types
+typedef void* FPDF_DOCUMENT;
+typedef void* FPDF_PAGE;
+typedef void* FPDF_WIDGET;
+typedef void* FPDF_STRINGHANDLE;
+typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc)
+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 void* FPDF_PAGERANGE;
+
+// Basic data types
+typedef void* FPDF_LPVOID;
+typedef void const* FPDF_LPCVOID;
+typedef int FPDF_RESULT;
+typedef int FPDF_BOOL;
+typedef int FPDF_ERROR;
+typedef unsigned long FPDF_DWORD;
+
+typedef float FS_FLOAT;
+
+// Duplex types
+typedef enum _FPDF_DUPLEXTYPE_ {
+ DuplexUndefined = 0,
+ Simplex,
+ DuplexFlipShortEdge,
+ DuplexFlipLongEdge
+} FPDF_DUPLEXTYPE;
+
+// String types
+typedef unsigned short FPDF_WCHAR;
+typedef unsigned char const* FPDF_LPCBYTE;
+typedef char const* FPDF_LPCSTR;
+
+// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE encoded), and platform dependent string
+typedef const char* FPDF_BYTESTRING;
+
+typedef const unsigned short* FPDF_WIDESTRING; // Foxit PDF SDK always use UTF-16LE encoding wide string,
+ // each character use 2 bytes (except surrogation), with low byte first.
+
+#ifndef _FPDF_DEF_STR_
+#define _FPDF_DEF_STR_
+/** @brief Structure for byte string.
+ *
+ * @note In SDK, a byte string commonly means a UTF-16LE format string.
+ */
+typedef struct _FPDF_BSTR
+{
+ /**
+ * @brief String buffer.
+ */
+ char* str;
+ /**
+ * @brief Length of a string, in bytes.
+ */
+ int len;
+} FPDF_BSTR;
+
+#endif
+
+// 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.
+
+#ifdef _WIN32_WCE
+typedef const unsigned short* FPDF_STRING;
+#else
+typedef const char* FPDF_STRING;
+#endif
+
+#ifndef _FS_DEF_MATRIX_
+#define _FS_DEF_MATRIX_
+/** @brief Matrix for transformation. */
+typedef struct _FS_MATRIX_
+{
+ float a; /**< @brief Coefficient a.*/
+ float b; /**< @brief Coefficient b.*/
+ float c; /**< @brief Coefficient c.*/
+ float d; /**< @brief Coefficient d.*/
+ float e; /**< @brief Coefficient e.*/
+ float f; /**< @brief Coefficient f.*/
+} FS_MATRIX;
+#endif
+
+#ifndef _FS_DEF_RECTF_
+#define _FS_DEF_RECTF_
+/** @brief Rectangle area(float) in device or page coordination system. */
+typedef struct _FS_RECTF_
+{
+ /**@{*/
+ /** @brief The x-coordinate of the left-top corner. */
+ float left;
+ /** @brief The y-coordinate of the left-top corner. */
+ float top;
+ /** @brief The x-coordinate of the right-bottom corner. */
+ float right;
+ /** @brief The y-coordinate of the right-bottom corner. */
+ float bottom;
+ /**@}*/
+}* FS_LPRECTF, FS_RECTF;
+/** @brief Const Pointer to ::FS_RECTF structure.*/
+typedef const FS_RECTF* FS_LPCRECTF;
+#endif
+
+#if defined(_WIN32) && defined(FPDFSDK_EXPORTS)
+// On Windows system, functions are exported in a DLL
+#define DLLEXPORT __declspec( dllexport )
+#define STDCALL __stdcall
+#else
+#define DLLEXPORT
+#define STDCALL
+#endif
+
+extern const char g_ExpireDate[];
+extern const char g_ModuleCodes[];
+
+// Exported Functions
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Function: FPDF_InitLibrary
+// Initialize the FPDFSDK library
+// Parameters:
+// None
+// Return value:
+// None.
+// Comments:
+// You have to call this function before you can call any PDF processing functions.
+
+DLLEXPORT void STDCALL FPDF_InitLibrary();
+
+
+// Function: FPDF_DestroyLibary
+// Release all resources allocated by the FPDFSDK library.
+// Parameters:
+// None.
+// Return value:
+// None.
+// Comments:
+// You can call this function to release all memory blocks allocated by the library.
+// After this function called, you should not call any PDF processing functions.
+DLLEXPORT void STDCALL FPDF_DestroyLibrary();
+
+//Policy for accessing the local machine time.
+#define FPDF_POLICY_MACHINETIME_ACCESS 0
+
+// Function: FPDF_SetSandBoxPolicy
+// Set the policy for the sandbox environment.
+// Parameters:
+// policy - The specified policy for setting, for example:FPDF_POLICY_MACHINETIME_ACCESS.
+// enable - True for enable, False for disable the policy.
+// Return value:
+// None.
+DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
+
+/**
+* Open and load a PDF document.
+* @param[in] file_path - Path to the PDF file (including extension).
+* @param[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.
+* The application should call ::FPDF_LoadXFA function after PDF document loaded
+* to support XFA fields in fpdfformfill.h file.
+*
+* @retval A handle to the loaded document. If failed, NULL is returned.
+*/
+DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path,
+ FPDF_BYTESTRING password);
+
+// Function: FPDF_LoadMemDocument
+// Open and load a PDF document from memory.
+// Parameters:
+// data_buf - Pointer to a buffer containing the PDF document.
+// size - Number of bytes in the PDF document.
+// password - A string used as the password for PDF file.
+// If no password needed, empty or NULL can be used.
+// Return value:
+// A handle to the loaded document. If failed, NULL is returned.
+// Comments:
+// 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.
+// Notes:
+// The application should call ::FPDF_LoadXFA function after PDF document loaded
+// to support XFA fields in fpdfformfill.h file.
+//
+DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf,
+ int size, FPDF_BYTESTRING password);
+
+// Structure for custom file access.
+typedef struct {
+ // File length, in bytes.
+ unsigned long m_FileLen;
+
+ // A function pointer for getting a block of data from specific position.
+ // Position is specified by byte offset from beginning of the file.
+ // The position and size will never go out range of file length.
+ // It may be possible for FPDFSDK to call this function multiple times for same position.
+ // Return value: should be non-zero if successful, zero for error.
+ int (*m_GetBlock)(void* param, unsigned long position, unsigned char* pBuf, unsigned long size);
+
+ // A custom pointer for all implementation specific data.
+ // This pointer will be used as the first parameter to m_GetBlock callback.
+ void* m_Param;
+} FPDF_FILEACCESS;
+
+/**
+ * @brief Structure for file reading or writing (I/O).
+ *
+ * @note This is a handler and should be implemented by callers.
+ */
+typedef struct _FPDF_FILEHANDLER
+{
+ /**
+ * @brief User-defined data.
+ * @note Callers can use this field to track controls.
+ */
+ FPDF_LPVOID clientData;
+ /**
+ * @brief Callback function to release the current file stream object.
+ *
+ * @param[in] clientData Pointer to user-defined data.
+ *
+ * @return None.
+ */
+ void (*Release)(FPDF_LPVOID clientData);
+ /**
+ * @brief Callback function to retrieve the current file stream size.
+ *
+ * @param[in] clientData Pointer to user-defined data.
+ *
+ * @return Size of file stream.
+ */
+ FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData);
+ /**
+ * @brief Callback function to read data from the current file stream.
+ *
+ * @param[in] clientData Pointer to user-defined data.
+ * @param[in] offset Offset position starts from the beginning of file stream. This parameter indicates reading position.
+ * @param[in] buffer Memory buffer to store data which are read from file stream. This parameter should not be <b>NULL</b>.
+ * @param[in] size Size of data which should be read from file stream, in bytes. The buffer indicated by the parameter <i>buffer</i> should be enough to store specified data.
+ *
+ * @return 0 for success, other value for failure.
+ */
+ FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPVOID buffer, FPDF_DWORD size);
+ /**
+ * @brief Callback function to write data into the current file stream.
+ *
+ * @param[in] clientData Pointer to user-defined data.
+ * @param[in] offset Offset position starts from the beginning of file stream. This parameter indicates writing position.
+ * @param[in] buffer Memory buffer contains data which is written into file stream. This parameter should not be <b>NULL</b>.
+ * @param[in] size Size of data which should be written into file stream, in bytes.
+ *
+ * @return 0 for success, other value for failure.
+ */
+ FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData, FPDF_DWORD offset, FPDF_LPCVOID buffer, FPDF_DWORD size);
+ /**
+ * @brief Callback function to flush all internal accessing buffers.
+ *
+ * @param[in] clientData Pointer to user-defined data.
+ *
+ * @return 0 for success, other value for failure.
+ */
+ FPDF_RESULT (*Flush)(FPDF_LPVOID clientData);
+ /**
+ * @brief Callback function to change file size.
+ *
+ * @details This function is called under writing mode usually. Implementer can determine whether to realize it based on application requests.
+ *
+ * @param[in] clientData Pointer to user-defined data.
+ * @param[in] size New size of file stream, in bytes.
+ *
+ * @return 0 for success, other value for failure.
+ */
+ FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size);
+
+} FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER;
+
+// Function: FPDF_LoadCustomDocument
+// Load PDF document from a custom access descriptor.
+// Parameters:
+// pFileAccess - A structure for access the file.
+// password - Optional password for decrypting the PDF file.
+// Return value:
+// A handle to the loaded document. If failed, NULL is returned.
+// Comments:
+// The application should maintain the file resources being valid until the PDF document close.
+// Loaded document can be closed by FPDF_CloseDocument.
+// Notes:
+// The application should call ::FPDF_LoadXFA function after PDF document loaded
+// to support XFA fields in fpdfformfill.h file.
+//
+DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess,
+ FPDF_BYTESTRING password);
+
+// Function: FPDF_GetFileVersion
+// Get the file version of the specific PDF document.
+// Parameters:
+// doc - Handle to document.
+// fileVersion - The PDF file version. File version: 14 for 1.4, 15 for 1.5, ...
+// Return value:
+// TRUE if this call succeed, If failed, FALSE is returned.
+// Comments:
+// If the document is created by function ::FPDF_CreateNewDocument, then this function would always fail.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, int* fileVersion);
+
+#define FPDF_ERR_SUCCESS 0 // No error.
+#define FPDF_ERR_UNKNOWN 1 // Unknown error.
+#define FPDF_ERR_FILE 2 // File not found or could not be opened.
+#define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted.
+#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.
+#define FPDF_ERR_XFALOAD 7 // Load XFA error.
+#define FPDF_ERR_XFALAYOUT 8 // Layout XFA error.
+
+// Function: FPDF_GetLastError
+// Get last error code when an SDK function failed.
+// Parameters:
+// None.
+// Return value:
+// A 32-bit integer indicating error codes (defined above).
+// Comments:
+// If the previous SDK call succeeded, the return value of this function
+// is not defined.
+//
+DLLEXPORT unsigned long STDCALL FPDF_GetLastError();
+
+// Function: FPDF_GetDocPermission
+// Get file permission flags of the document.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument function.
+// Return value:
+// A 32-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_GetDocPermissions(FPDF_DOCUMENT document);
+
+// Function: FPDF_GetSecurityHandlerRevision
+// Get the revision for security handler.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument function.
+// Return value:
+// The security handler revision number. Please refer to PDF Reference for
+// detailed description. If the document is not protected, -1 will be returned.
+//
+DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document);
+
+// Function: FPDF_GetPageCount
+// Get total number of pages in a document.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument function.
+// Return value:
+// Total number of pages in the document.
+//
+DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document);
+
+// Function: FPDF_LoadPage
+// Load a page inside a document.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument function.
+// page_index - Index number of the page. 0 for the first page.
+// Return value:
+// A handle to the loaded page. If failed, NULL is returned.
+// Comments:
+// Loaded page can be rendered to devices using FPDF_RenderPage function.
+// Loaded page can be closed by FPDF_ClosePage.
+//
+DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, int page_index);
+
+// Function: FPDF_GetPageWidth
+// Get page width.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage function.
+// Return value:
+// Page width (excluding non-displayable area) measured in points.
+// One point is 1/72 inch (around 0.3528 mm).
+//
+DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page);
+
+// Function: FPDF_GetPageHeight
+// Get page height.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage function.
+// Return value:
+// Page height (excluding non-displayable area) measured in points.
+// One point is 1/72 inch (around 0.3528 mm)
+//
+DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page);
+
+// Function: FPDF_GetPageSizeByIndex
+// Get the size of a page by index.
+// Parameters:
+// document - Handle to document. Returned by FPDF_LoadDocument function.
+// page_index - Page index, zero for the first page.
+// width - Pointer to a double value receiving the page width (in points).
+// height - Pointer to a double value receiving the page height (in points).
+// Return value:
+// Non-zero for success. 0 for error (document or page not found).
+//
+DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, int page_index, double* width, double* height);
+
+
+// Page rendering flags. They can be combined with bit OR.
+#define FPDF_ANNOT 0x01 // Set if annotations are to be rendered.
+#define FPDF_LCD_TEXT 0x02 // Set if using text rendering optimized for LCD display.
+#define FPDF_NO_NATIVETEXT 0x04 // Don't use the native text output available on some platforms
+#define FPDF_GRAYSCALE 0x08 // Grayscale output.
+#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_NO_CATCH 0x100 // Set if you don't want to catch exception.
+#define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 // Limit image cache size.
+#define FPDF_RENDER_FORCEHALFTONE 0x400 // Always use halftone for image stretching.
+#define FPDF_PRINTING 0x800 // Render for printing.
+#define FPDF_REVERSE_BYTE_ORDER 0x10 //set whether render in a reverse Byte order, this flag only
+ //enable when render to a bitmap.
+#ifdef _WIN32
+// Function: FPDF_RenderPage
+// Render contents in a page to a device (screen, bitmap, or printer).
+// This function is only supported on Windows system.
+// Parameters:
+// dc - Handle to device context.
+// page - Handle to the page. Returned by FPDF_LoadPage function.
+// start_x - Left pixel position of the display area in the device coordinate.
+// start_y - Top pixel position of the display area in the device coordinate.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+// flags - 0 for normal display, or combination of flags defined above.
+// Return value:
+// None.
+// Notes:
+// The method can not support to render the page for the document consists of dynamic XFA fields.
+//
+DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
+ int rotate, int flags);
+#endif
+
+// Function: FPDF_RenderPageBitmap
+// Render contents in a page to a device independent bitmap
+// Parameters:
+// bitmap - Handle to the device independent bitmap (as the output buffer).
+// Bitmap handle can be created by FPDFBitmap_Create function.
+// page - Handle to the page. Returned by FPDF_LoadPage function.
+// start_x - Left pixel position of the display area in the bitmap coordinate.
+// start_y - Top pixel position of the display area in the bitmap coordinate.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+// flags - 0 for normal display, or combination of flags defined above.
+// Return value:
+// None.
+// Notes:
+// The method can not support to render the page for the document consists of dynamic XFA fields.
+//
+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);
+
+// Function: FPDF_ClosePage
+// Close a loaded PDF page.
+// Parameters:
+// page - Handle to the loaded page.
+// Return value:
+// None.
+//
+DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);
+
+// Function: FPDF_CloseDocument
+// Close a loaded PDF document.
+// Parameters:
+// document - Handle to the loaded document.
+// Return value:
+// None.
+//
+DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
+
+// Function: FPDF_DeviceToPage
+// Convert the screen coordinate of a point to page coordinate.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage function.
+// start_x - Left pixel position of the display area in the device coordinate.
+// start_y - Top pixel position of the display area in the device coordinate.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+// device_x - X value in device coordinate, for the point to be converted.
+// device_y - Y value in device coordinate, for the point to be converted.
+// page_x - A Pointer to a double receiving the converted X value in page coordinate.
+// page_y - A Pointer to a double receiving the converted Y value in page coordinate.
+// Return value:
+// None.
+// Comments:
+// 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.
+//
+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);
+
+// Function: FPDF_PageToDevice
+// Convert the page coordinate of a point to screen coordinate.
+// Parameters:
+// page - Handle to the page. Returned by FPDF_LoadPage function.
+// start_x - Left pixel position of the display area in the device coordinate.
+// start_y - Top pixel position of the display area in the device coordinate.
+// size_x - Horizontal size (in pixels) for displaying the page.
+// size_y - Vertical size (in pixels) for displaying the page.
+// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),
+// 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise).
+// page_x - X value in page coordinate, for the point to be converted.
+// page_y - Y value in page coordinate, for the point to be converted.
+// device_x - A pointer to an integer receiving the result X value in device coordinate.
+// device_y - A pointer to an integer receiving the result Y value in device coordinate.
+// Return value:
+// None.
+// Comments:
+// See comments of FPDF_DeviceToPage() function.
+//
+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);
+
+// Function: FPDFBitmap_Create
+// Create a Foxit Device Independent Bitmap (FXDIB).
+// Parameters:
+// width - Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
+// height - Number of pixels in a vertical line of the bitmap. Must be greater than 0.
+// alpha - A flag indicating whether alpha channel is used. Non-zero for using alpha, zero for not using.
+// Return value:
+// The created bitmap handle, or NULL if parameter error or out of memory.
+// Comments:
+// 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.
+DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha);
+
+// More DIB formats
+#define FPDFBitmap_Gray 1 // Gray scale bitmap, one byte per pixel.
+#define FPDFBitmap_BGR 2 // 3 bytes per pixel, byte order: blue, green, red.
+#define FPDFBitmap_BGRx 3 // 4 bytes per pixel, byte order: blue, green, red, unused.
+#define FPDFBitmap_BGRA 4 // 4 bytes per pixel, byte order: blue, green, red, alpha.
+
+// Function: FPDFBitmap_CreateEx
+// Create a Foxit Device Independent Bitmap (FXDIB)
+// Parameters:
+// width - Number of pixels in a horizontal line of the bitmap. Must be greater than 0.
+// height - Number of pixels in a vertical line of the bitmap. Must be greater than 0.
+// format - A number indicating for bitmap format, as defined above.
+// 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.
+// stride - Number of bytes for each scan line, for external buffer only..
+// Return value:
+// The created bitmap handle, or NULL if parameter error or out of memory.
+// Comments:
+// 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.
+//
+DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int format, void* first_scan, int stride);
+
+// Function: FPDFBitmap_FillRect
+// Fill a rectangle area in an FXDIB.
+// Parameters:
+// bitmap - The handle to the bitmap. Returned by FPDFBitmap_Create function.
+// left - The left side position. Starting from 0 at the left-most pixel.
+// top - The top side position. Starting from 0 at the top-most scan line.
+// width - Number of pixels to be filled in each scan line.
+// height - Number of scan lines to be filled.
+// color - A 32-bit value specifing the color, in 8888 ARGB format.
+// Return value:
+// None.
+// Comments:
+// 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.
+//
+DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, FPDF_DWORD color);
+
+// Function: FPDFBitmap_GetBuffer
+// Get data buffer of an FXDIB
+// Parameters:
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// Return value:
+// The pointer to the first byte of the bitmap buffer.
+// Comments:
+// The stride may be more than width * number of bytes per pixel
+// 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.
+DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
+
+// Function: FPDFBitmap_GetWidth
+// Get width of an FXDIB.
+// Parameters:
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// Return value:
+// The number of pixels in a horizontal line of the bitmap.
+DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);
+
+// Function: FPDFBitmap_GetHeight
+// Get height of an FXDIB.
+// Parameters:
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// Return value:
+// The number of pixels in a vertical line of the bitmap.
+DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);
+
+// Function: FPDFBitmap_GetStride
+// Get number of bytes for each scan line in the bitmap buffer.
+// Parameters:
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// Return value:
+// The number of bytes for each scan line in the bitmap buffer.
+// Comments:
+// The stride may be more than width * number of bytes per pixel
+DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap);
+
+// Function: FPDFBitmap_Destroy
+// Destroy an FXDIB and release all related buffers.
+// Parameters:
+// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create function.
+// Return value:
+// None.
+// Comments:
+// This function will not destroy any external buffer.
+//
+DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap);
+
+// Function: FPDF_VIEWERREF_GetPrintScaling
+// Whether the PDF document prefers to be scaled or not.
+// Parameters:
+// document - Handle to the loaded document.
+// Return value:
+// None.
+//
+DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
+
+// Function: FPDF_VIEWERREF_GetNumCopies
+// Returns the number of copies to be printed.
+// Parameters:
+// document - Handle to the loaded document.
+// Return value:
+// The number of copies to be printed.
+//
+DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document);
+
+// Function: FPDF_VIEWERREF_GetPrintPageRange
+// Page numbers to initialize print dialog box when file is printed.
+// Parameters:
+// document - Handle to the loaded document.
+// Return value:
+// The print page range to be used for printing.
+//
+DLLEXPORT FPDF_PAGERANGE STDCALL FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document);
+
+// Function: FPDF_VIEWERREF_GetDuplex
+// Returns the paper handling option to be used when printing from print dialog.
+// Parameters:
+// document - Handle to the loaded document.
+// Return value:
+// The paper handling option to be used when printing.
+//
+DLLEXPORT FPDF_DUPLEXTYPE STDCALL FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
+
+// Function: FPDF_CountNamedDests
+// Get the count of named destinations in the PDF document.
+// Parameters:
+// document - Handle to a document
+// Return value:
+// The count of named destinations.
+DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document);
+
+// Function: FPDF_GetNamedDestByName
+// get a special dest handle by the index.
+// Parameters:
+// document - Handle to the loaded document.
+// name - The name of a special named dest.
+// Return value:
+// The handle of the dest.
+//
+DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,FPDF_BYTESTRING name);
+
+// Function: FPDF_GetNamedDest
+// Get the specified named destinations of the PDF document by index.
+// Parameters:
+// document - Handle to a document
+// index - The index of named destination.
+// buffer - The buffer to obtain destination name, used as wchar_t*.
+// buflen [in/out] - Size of the buffer in bytes on input, length of the result in bytes on output or -1 if the buffer is too small.
+// Return value:
+// The destination handle of a named destination, or NULL if no named destination corresponding to |index|.
+// Comments:
+// Call this function twice to get the name of the named destination:
+// 1) First time pass in |buffer| as NULL and get buflen.
+// 2) Second time pass in allocated |buffer| and buflen to retrieve |buffer|, which should be used as wchar_t*.
+// If buflen is not sufficiently large, it will be set to -1 upon return.
+//
+DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index, void* buffer, long& buflen);
+
+// Function: FPDF_BStr_Init
+// Helper function to initialize a byte string.
+DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str);
+
+// Function: FPDF_BStr_Set
+// Helper function to set string data.
+DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, FPDF_LPCSTR bstr, int length);
+
+// Function: FPDF_BStr_Clear
+// Helper function to clear a byte string.
+DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // _FPDFVIEW_H_