diff options
author | Nico Weber <thakis@chromium.org> | 2015-08-04 13:00:21 -0700 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2015-08-04 13:00:21 -0700 |
commit | 9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f (patch) | |
tree | c97037f398d714665aefccb6eb54d0969ad7030c /public | |
parent | 780cee82236d1b3b0f9b01a22424e4b8ec9a6f12 (diff) | |
download | pdfium-9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f.tar.xz |
XFA: clang-format all pdfium code.
No behavior change.
Generated by:
find . -name '*.cpp' -o -name '*.h' | \
grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \
xargs ../../buildtools/mac/clang-format -i
Then manually merged https://codereview.chromium.org/1269223002/
See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion.
BUG=none
Diffstat (limited to 'public')
-rw-r--r-- | public/fpdf_dataavail.h | 220 | ||||
-rw-r--r-- | public/fpdf_doc.h | 217 | ||||
-rw-r--r-- | public/fpdf_edit.h | 189 | ||||
-rw-r--r-- | public/fpdf_ext.h | 114 | ||||
-rw-r--r-- | public/fpdf_flatten.h | 25 | ||||
-rw-r--r-- | public/fpdf_formfill.h | 2143 | ||||
-rw-r--r-- | public/fpdf_fwlevent.h | 193 | ||||
-rw-r--r-- | public/fpdf_ppo.h | 18 | ||||
-rw-r--r-- | public/fpdf_progressive.h | 131 | ||||
-rw-r--r-- | public/fpdf_save.h | 72 | ||||
-rw-r--r-- | public/fpdf_searchex.h | 9 | ||||
-rw-r--r-- | public/fpdf_sysfontinfo.h | 372 | ||||
-rw-r--r-- | public/fpdf_text.h | 265 | ||||
-rw-r--r-- | public/fpdf_transformpage.h | 103 | ||||
-rw-r--r-- | public/fpdfview.h | 743 |
15 files changed, 2881 insertions, 1933 deletions
diff --git a/public/fpdf_dataavail.h b/public/fpdf_dataavail.h index b303560e06..3ab02fe59f 100644 --- a/public/fpdf_dataavail.h +++ b/public/fpdf_dataavail.h @@ -12,10 +12,9 @@ #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 - +#define FSDK_IS_LINEARIZED 1 +#define FSDK_NOT_LINEARIZED 0 +#define FSDK_UNKNOW_LINEARIZED -1 #ifdef __cplusplus extern "C" { @@ -26,28 +25,29 @@ extern "C" { * 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. - */ - FPDF_BOOL (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, size_t offset, size_t size); + /** + * 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. + */ + FPDF_BOOL (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, size_t offset, size_t size); } FX_FILEAVAIL; typedef void* FPDF_AVAIL; @@ -57,23 +57,29 @@ typedef void* FPDF_AVAIL; * 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. +* 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. +* 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. +* 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); +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 +* avail - Handle to document availability provider returned by +* FPDFAvail_Create * Return Value: * None. */ @@ -81,63 +87,79 @@ DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail); /** * Interface: FX_DOWNLOADHINTS - * Download hints interface. Used to receive hints for further downloading. + * 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); + /** + * 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. +* 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 +* 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. +* 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); +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 +* 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. +* 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); @@ -151,7 +173,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail, * 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, +* 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. */ @@ -159,57 +182,78 @@ DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc); /** * Function: FPDFAvail_IsPageAvail -* Check whether a page is ready for loading, if not, get download hints. +* Check whether a page is ready for loading, if not, get download +* hints. * * Parameters: -* avail - Handle to document availability provider returned by FPDFAvail_Create +* 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 +* 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 +* 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); +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. +* 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 +* 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. +* 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 +* 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); +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 +* 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. +* 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 +* 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. * */ diff --git a/public/fpdf_doc.h b/public/fpdf_doc.h index 0fe1aae3c3..9e3f0af6d1 100644 --- a/public/fpdf_doc.h +++ b/public/fpdf_doc.h @@ -15,24 +15,32 @@ extern "C" { #endif // Function: FPDFBookmark_GetFirstChild -// Get the first child of a bookmark item, or the first top level bookmark item. +// 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. +// 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. +// 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); +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. +// 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. +// 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); +DLLEXPORT FPDF_BOOKMARK STDCALL +FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); // Function: FPDFBookmark_GetTitle // Get title of a bookmark. @@ -43,27 +51,38 @@ DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetNextSibling(FPDF_DOCUMENT docume // 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 +// 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. +// 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); +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. +// 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. +// 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); +DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, + FPDF_WIDESTRING title); // Function: FPDFBookmark_GetDest // Get the destination associated with a bookmark item. @@ -71,26 +90,30 @@ DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_W // 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. +// 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); +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 +// 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. +#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. @@ -105,15 +128,19 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action); // Get destination of an action. // Parameters: // document - Handle to the document. -// action - Handle to the action. It must be a GOTO or REMOTEGOTO action. +// 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 +// 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); +DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, + FPDF_ACTION action); // Function: FPDFAction_GetURIPath // Get URI path of a URI action. @@ -127,12 +154,16 @@ DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTI // 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 +// 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); +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. @@ -142,67 +173,86 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FP // Return value: // The page index. Starting from 0 for the first page. // -DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FPDF_DEST dest); +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. +// 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 +// 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. +// 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); +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. +// 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 +// 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); +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. +// 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. +// 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. +// 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. +// 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); +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). +// 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); +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. @@ -216,21 +266,21 @@ 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; +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. +// 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. @@ -238,33 +288,46 @@ typedef struct _FS_QUADPOINTSF // Return value: // True if succeed, else False. // -DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quadIndex, FS_QUADPOINTSF* quadPoints); +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. +// 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". +// 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 +// 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 +// 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); - +DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, + FPDF_BYTESTRING tag, + void* buffer, + unsigned long buflen); #ifdef __cplusplus } diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h index 7032d6078c..253f6686d7 100644 --- a/public/fpdf_edit.h +++ b/public/fpdf_edit.h @@ -11,14 +11,18 @@ #include "fpdfview.h" -// Define all types used in the SDK. Note they can be simply regarded as opaque pointers +// 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) ((((uint32_t)(((uint8_t)(b)|((FX_WORD)((uint8_t)(g))<<8))|(((FX_DWORD)(uint8_t)(r))<<16)))) | (((FX_DWORD)(uint8_t)(a))<<24)) -#define FPDF_GetBValue(argb) ((uint8_t)(argb)) -#define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8)) -#define FPDF_GetRValue(argb) ((uint8_t)((argb)>>16)) -#define FPDF_GetAValue(argb) ((uint8_t)((argb)>>24)) +#define FPDF_ARGB(a, r, g, b) \ + ((((uint32_t)(((uint8_t)(b) | ((FX_WORD)((uint8_t)(g)) << 8)) | \ + (((FX_DWORD)(uint8_t)(r)) << 16)))) | \ + (((FX_DWORD)(uint8_t)(a)) << 24)) +#define FPDF_GetBValue(argb) ((uint8_t)(argb)) +#define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8)) +#define FPDF_GetRValue(argb) ((uint8_t)((argb) >> 16)) +#define FPDF_GetAValue(argb) ((uint8_t)((argb) >> 24)) #ifdef __cplusplus extern "C" { @@ -48,7 +52,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument(); // Function: FPDFPage_New // Construct an empty page. // Parameters: -// document - Handle to document. Returned by FPDF_LoadDocument and FPDF_CreateNewDocument. +// 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. @@ -57,108 +62,135 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument(); // 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. +// 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); +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. +// 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. +// 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). +// 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. +// 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. +// 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). +// 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. +// 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. +// 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. +// 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 +// 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. +// 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); +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. +// 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. +// 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. +// 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. +// 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. +// Check that whether the content of specified PDF page contains +// transparency. // Parameters: -// page - Handle to a page. Returned by FPDFPage_New or FPDF_LoadPage. +// 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. +// 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. +// 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. +// 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. +// The method can not support this feature for the document consists of +// dynamic XFA fields. // DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page); @@ -169,18 +201,21 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page); ////////////////////////////////////////////////////////////////////// // Function: FPDFPageObj_HasTransparency -// Check that whether the specified PDF page object contains transparency. +// 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); +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. +// 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. @@ -190,7 +225,12 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObje // Return value: // None. DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, - double a, double b, double c, double d, double e, double f); + 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. @@ -205,16 +245,22 @@ DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, // Return value: // None. // Notes: -// The method can not support this feature for the document consists of dynamic XFA fields. +// 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); + 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 +#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 ////////////////////////////////////////////////////////////////////// // @@ -225,33 +271,45 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, // Function: FPDFPageObj_NewImgeObj // Create a new Image Object. // Parameters: -// document - Handle to document. Returned by FPDF_LoadDocument or FPDF_CreateNewDocument function. +// 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); - +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. +// 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. +// 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. +// 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. +// 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. +// 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); - +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. +// 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. @@ -261,21 +319,32 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, int nCou // 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); + 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. +// 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. +// 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); +DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, + int nCount, + FPDF_PAGEOBJECT image_object, + FPDF_BITMAP bitmap); #ifdef __cplusplus } diff --git a/public/fpdf_ext.h b/public/fpdf_ext.h index 8016d2ebc4..c80dcbbf58 100644 --- a/public/fpdf_ext.h +++ b/public/fpdf_ext.h @@ -13,45 +13,44 @@ 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 +// 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)(struct _UNSUPPORT_INFO* pThis, int nType); +#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)(struct _UNSUPPORT_INFO* pThis, int nType); } UNSUPPORT_INFO; /** @@ -63,37 +62,40 @@ typedef struct _UNSUPPORT_INFO * TRUE means successful. FALSE means fails. **/ -DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info); +DLLEXPORT FPDF_BOOL STDCALL +FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info); -//flags for page mode. +// flags for page mode. -//Unknown value -#define PAGEMODE_UNKNOWN -1 +// Unknown value +#define PAGEMODE_UNKNOWN -1 -//Neither document outline nor thumbnail images visible -#define PAGEMODE_USENONE 0 +// Neither document outline nor thumbnail images visible +#define PAGEMODE_USENONE 0 -//Document outline visible -#define PAGEMODE_USEOUTLINES 1 +// Document outline visible +#define PAGEMODE_USEOUTLINES 1 -//Thumbnial images visible -#define PAGEMODE_USETHUMBS 2 +// 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 +// 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 +// Optional content group panel visible +#define PAGEMODE_USEOC 4 -//Attachments panel visible +// Attachments panel visible #define PAGEMODE_USEATTACHMENTS 5 - /** * Function: FPDFDoc_GetPageMode - * Get the document's PageMode(How the document should be displayed when opened) + * Get the document's PageMode(How the document should be displayed + *when opened) * Parameters: - * doc - Handle to document. Returned by FPDF_LoadDocument function. + * doc - Handle to document. Returned by FPDF_LoadDocument + *function. * Return Value: * The flags for page mode. **/ diff --git a/public/fpdf_flatten.h b/public/fpdf_flatten.h index 3ae3cd57f3..5496846297 100644 --- a/public/fpdf_flatten.h +++ b/public/fpdf_flatten.h @@ -10,28 +10,33 @@ #include "fpdfview.h" // Result codes. -#define FLATTEN_FAIL 0 // Flatten operation failed. -#define FLATTEN_SUCCESS 1 // Flatten operation succeed. -#define FLATTEN_NOTHINGTODO 2 // There is nothing to be flattened. +#define FLATTEN_FAIL 0 // Flatten operation failed. +#define FLATTEN_SUCCESS 1 // Flatten operation succeed. +#define FLATTEN_NOTHINGTODO 2 // There is nothing to be flattened. // Flags. -#define FLAT_NORMALDISPLAY 0 -#define FLAT_PRINT 1 +#define FLAT_NORMALDISPLAY 0 +#define FLAT_PRINT 1 #ifdef __cplusplus extern "C" { #endif // Function: FPDFPage_Flatten -// Make annotations and form fields become part of the page contents itself. +// Make annotations and form fields become part of the page contents +// itself. // Parameters: // page - Handle to the page, as returned by FPDF_LoadPage(). -// nFlag - Intended use of the flattened result: 0 for normal display, 1 for printing. +// nFlag - Intended use of the flattened result: 0 for normal display, +// 1 for printing. // Return value: -// Either FLATTEN_FAIL, FLATTEN_SUCCESS, or FLATTEN_NOTHINGTODO (see above). +// Either FLATTEN_FAIL, FLATTEN_SUCCESS, or FLATTEN_NOTHINGTODO (see +// above). // Comments: -// Currently, all failures return FLATTEN_FAIL, with no indication for the reason -// for the failure. The method does not support flattening any dynamic XFA fields. +// Currently, all failures return FLATTEN_FAIL, with no indication for +// the reason +// for the failure. The method does not support flattening any dynamic +// XFA fields. DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag); #ifdef __cplusplus diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h index fda0a87f97..0b42cac8de 100644 --- a/public/fpdf_formfill.h +++ b/public/fpdf_formfill.h @@ -11,282 +11,348 @@ 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 +#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 2. - **/ - int version; +typedef struct _IPDF_JsPlatform { + /** + * Version number of the interface. Currently must be 2. + **/ + int version; - /* Version 1. */ + /* Version 1. */ - /** - * 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; + /** + * 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); - /* Version 2. */ + /** + * 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); - /** - * pointer to the v8::Isolate to use, or NULL to force PDFium to create one. - **/ - void* m_isolate; - - /** - * The embedder data slot to use in the v8::Isolate to store PDFium's - * per-isolate data. The value needs to be between 0 and - * v8::Internals::kNumIsolateDataLots (exclusive). - */ - unsigned int m_v8EmbedderSlot; + /** + * 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; + + /* Version 2. */ + + /** + * pointer to the v8::Isolate to use, or NULL to force PDFium to create one. + **/ + void* m_isolate; + + /** + * The embedder data slot to use in the v8::Isolate to store PDFium's + * per-isolate data. The value needs to be between 0 and + * v8::Internals::kNumIsolateDataLots (exclusive). + */ + unsigned int m_v8EmbedderSlot; } 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 +#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. + * 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); +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 +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 +#define FXFA_PAGEVIEWEVENT_POSTADDED 1 /** @brief After a pageview is removed. */ -#define FXFA_PAGEVIEWEVENT_POSTREMOVED 3 +#define FXFA_PAGEVIEWEVENT_POSTREMOVED 3 /*@}*/ // menu @@ -294,12 +360,12 @@ typedef struct _FPDF_SYSTEMTIME * @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 +#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 @@ -307,283 +373,336 @@ typedef struct _FPDF_SYSTEMTIME * @name Macro Definitions for File Type. */ /*@{*/ -#define FXFA_SAVEAS_XML 1 -#define FXFA_SAVEAS_XDP 2 +#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); +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_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_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_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_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_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_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_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_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_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); + /** + * 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; + IPDF_JSPLATFORM* m_pJsPlatform; /** * Method: FFI_DisplayCaret @@ -594,249 +713,318 @@ typedef struct _FPDF_FORMFILLINFO * 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. + * 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_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); + 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); + /** + * 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. + * 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); +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. + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. * Return Value: * NULL. **/ @@ -844,250 +1032,355 @@ 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. + * 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. + * 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); +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 + * 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. + * 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); +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 +* 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. +* 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; +* 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. +* 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. +* 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. +* 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. +#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. +* 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. +* 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. +* 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); +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 +#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. +* 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. +* 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. +* 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); +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. + * 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. + * 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); +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. + * 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. + * 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. + * 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); +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. + * 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. + * 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); +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. + * 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. + * 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); +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. + * 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. + * 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); +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. + * 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. + * 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. + * 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); +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. + * 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. + * 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. +#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. + * 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); +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. + * 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. + * 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 + * 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. + * 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); +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. + * 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. + * 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); - +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. + * 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. + * Please refresh the client window to remove the highlight immediately + *if necessary. **/ DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle); @@ -1095,42 +1388,69 @@ 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. +* 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. +* 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. +* 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); +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. + * 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. + * 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. + * TRUE indicates that the input document has XFA fields, + *otherwise FALSE. **/ -DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, int* docType); +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. + * 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. + * document - Handle to document. Returned by + *FPDF_LoadDocument function. * Return Value: * TRUE indicates success,otherwise FALSE. **/ @@ -1138,96 +1458,138 @@ 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. + * This method will implement the undo feature for the specified xfa + *field. * Parameters: - * document - Handle to document. Returned by FPDF_LoadDocument function. + * 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); +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. + * This method will implement the redo feature for the specified xfa + *field. * Parameters: - * document - Handle to document. Returned by FPDF_LoadDocument function. + * 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); +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. + * This method will implement the select all feature for the specified + *xfa field. * Parameters: - * document - Handle to document. Returned by FPDF_LoadDocument function. + * 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); +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. + * This method will implement the copy feature for the specified xfa + *field. * Parameters: - * document - Handle to document. Returned by FPDF_LoadDocument function. + * 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. + * 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); +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. + * This method will implement the cut feature for the specified xfa + *field. * Parameters: - * document - Handle to document. Returned by FPDF_LoadDocument function. + * 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. + * 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); +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. + * This method will implement the paste feature for the specified xfa + *field. * Parameters: - * document - Handle to document. Returned by FPDF_LoadDocument function. + * 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); +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. + * This method will implement the spell check feature for the specified + *xfa field. * Parameters: - * document - Handle to document. Returned by FPDF_LoadDocument function. + * 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. + * 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); +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. + * This method will implement the spell check feature for the specified + *xfa field. * Parameters: - * document - Handle to document. Returned by FPDF_LoadDocument function. + * 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. + * 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); +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. @@ -1243,12 +1605,17 @@ DLLEXPORT int STDCALL FPDF_StringHandleCounts(FPDF_STRINGHANDLE stringHandle); * 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. + * 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); +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. @@ -1263,12 +1630,16 @@ DLLEXPORT void STDCALL FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle); * 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. + * 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); +DLLEXPORT FPDF_BOOL STDCALL +FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, + FPDF_BYTESTRING bsText, + FPDF_DWORD size); #ifdef __cplusplus } diff --git a/public/fpdf_fwlevent.h b/public/fpdf_fwlevent.h index fa4f144fcc..22c01e4297 100644 --- a/public/fpdf_fwlevent.h +++ b/public/fpdf_fwlevent.h @@ -13,90 +13,84 @@ extern "C" { #endif -typedef int FPDF_INT32; +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 , +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, +// 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, +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 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; +// 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, +// 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_Accept = 0x1E, FWL_VKEY_ModeChange = 0x1F, FWL_VKEY_Space = 0x20, FWL_VKEY_Prior = 0x21, @@ -248,41 +242,36 @@ typedef enum FWL_VKEY_Unknown = 0, } FWL_VKEYCODE; -//key event command -typedef enum -{ - FWL_EVENTKEYCMD_KeyDown = 1, - FWL_EVENTKEYCMD_KeyUp, - FWL_EVENTKEYCMD_Char, +// 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; +// 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; +// 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; }; #ifdef __cplusplus diff --git a/public/fpdf_ppo.h b/public/fpdf_ppo.h index 1021faec76..9645545bfa 100644 --- a/public/fpdf_ppo.h +++ b/public/fpdf_ppo.h @@ -19,24 +19,30 @@ extern "C" { // 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. +// 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. +// 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); - +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. +// 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); +DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, + FPDF_DOCUMENT src_doc); #ifdef __cplusplus } diff --git a/public/fpdf_progressive.h b/public/fpdf_progressive.h index d1bbc401d9..1150349393 100644 --- a/public/fpdf_progressive.h +++ b/public/fpdf_progressive.h @@ -9,89 +9,114 @@ #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 - +// 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; -//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); + /* + * 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; + // 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. +// 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. +// 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 +// 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. +// 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. +// 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); +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. +// 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. +// 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. +// 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); +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 +// 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. +// 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. +// 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); diff --git a/public/fpdf_save.h b/public/fpdf_save.h index aa326032ca..4eea054eda 100644 --- a/public/fpdf_save.h +++ b/public/fpdf_save.h @@ -13,66 +13,72 @@ extern "C" { #endif - // Structure for custom file write typedef struct FPDF_FILEWRITE_ { + // + // Version number of the interface. Currently must be 1. + // + int version; - // - //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)(struct FPDF_FILEWRITE_* pThis, const void* pData, unsigned long size); + // + // 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)(struct FPDF_FILEWRITE_* pThis, + const void* pData, + unsigned long size); } FPDF_FILEWRITE; /** @brief Incremental. */ -#define FPDF_INCREMENTAL 1 +#define FPDF_INCREMENTAL 1 /** @brief No Incremental. */ -#define FPDF_NO_INCREMENTAL 2 +#define FPDF_NO_INCREMENTAL 2 /** @brief Remove security. */ -#define FPDF_REMOVE_SECURITY 3 +#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. +// 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 ); +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. +// 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, ... +// 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); +DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, + FPDF_FILEWRITE* pFileWrite, + FPDF_DWORD flags, + int fileVersion); #ifdef __cplusplus } diff --git a/public/fpdf_searchex.h b/public/fpdf_searchex.h index 1d43eab8cf..a6b6e1bdbf 100644 --- a/public/fpdf_searchex.h +++ b/public/fpdf_searchex.h @@ -16,11 +16,14 @@ extern "C" { // 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. +// 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); +DLLEXPORT int STDCALL +FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex); #ifdef __cplusplus } diff --git a/public/fpdf_sysfontinfo.h b/public/fpdf_sysfontinfo.h index 61465f4262..c2da74b70b 100644 --- a/public/fpdf_sysfontinfo.h +++ b/public/fpdf_sysfontinfo.h @@ -10,22 +10,22 @@ #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_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 +#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) +#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 +#define FXFONT_FW_NORMAL 400 +#define FXFONT_FW_BOLD 700 // Exported Functions #ifdef __cplusplus @@ -37,168 +37,200 @@ extern "C" { * Interface for getting system font information and font mapping */ typedef struct _FPDF_SYSFONTINFO { - /** - * Version number of the interface. Currently must be 1. - **/ - int version; + /** + * 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: 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: 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 a 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, FPDF_BOOL bItalic, int charset, int pitch_family, - const char* face, FPDF_BOOL* bExact); + /** + * 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 a 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, + FPDF_BOOL bItalic, + int charset, + int pitch_family, + const char* face, + FPDF_BOOL* 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: 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: 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: 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: 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); + /** + * 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; /** * Struct: FPDF_CharsetFontMap * Provides the name of a font to use for a given charset value. **/ -typedef struct FPDF_CharsetFontMap_ -{ - int charset; // Character Set Enum value, see FXFONT_*_CHARSET above. - const char* fontname; // Name of default font to use with that charset. +typedef struct FPDF_CharsetFontMap_ { + int charset; // Character Set Enum value, see FXFONT_*_CHARSET above. + const char* fontname; // Name of default font to use with that charset. } FPDF_CharsetFontMap; /** @@ -217,7 +249,8 @@ DLLEXPORT const FPDF_CharsetFontMap* STDCALL FPDF_GetDefaultTTFMap(); * 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. + * 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 @@ -225,13 +258,16 @@ DLLEXPORT const FPDF_CharsetFontMap* STDCALL FPDF_GetDefaultTTFMap(); * Return Value: * None. **/ -DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, const char* face, int charset); +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, + * 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 @@ -244,14 +280,18 @@ 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. + * 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. + * 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. + * Application should call FPDF_FreeMemory to free the returned + *pointer. **/ DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo(); diff --git a/public/fpdf_text.h b/public/fpdf_text.h index 3c0afd2498..3046bb0f85 100644 --- a/public/fpdf_text.h +++ b/public/fpdf_text.h @@ -17,21 +17,26 @@ extern "C" { // 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). +// 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. +// 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. +// 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. +// 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. +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. // Return Value: // None. // @@ -40,13 +45,17 @@ 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. +// 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. +// 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 +// 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); @@ -54,149 +63,213 @@ 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. +// 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, +// 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); +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. +// 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). +// 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); +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. +// 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. +// 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); +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. +// 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. +// 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. +// 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 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); + 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. +// 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. +// 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. +// 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); +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. +// 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 +// 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); +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. +// 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. +// 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. +// 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); +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. +// 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. +// 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 +// 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. +// 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); - +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. +#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. +// 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. +// 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); +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. +// handle - A search context handle returned by +// FPDFText_FindStart. // Return Value: // Whether a match is found. // @@ -205,7 +278,8 @@ 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. +// handle - A search context handle returned by +// FPDFText_FindStart. // Return Value: // Whether a match is found. // @@ -214,7 +288,8 @@ 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. +// handle - A search context handle returned by +// FPDFText_FindStart. // Return Value: // Index for the starting character. // @@ -223,7 +298,8 @@ 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. +// handle - A search context handle returned by +// FPDFText_FindStart. // Return Value: // Number of matched characters. // @@ -232,7 +308,8 @@ 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. +// handle - A search context handle returned by +// FPDFText_FindStart. // Return Value: // None. // @@ -241,16 +318,22 @@ 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. +// 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, +// 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. @@ -272,12 +355,17 @@ DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page); // 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. +// 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, +// 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); +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. @@ -287,7 +375,8 @@ DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, int link_index, u // Return Value: // Number of rectangular areas for the link. // -DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, int link_index); +DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, + int link_index); // Function: FPDFLink_GetRect // Fetch the boundaries of a rectangle for a link. @@ -295,15 +384,24 @@ DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, int link_inde // 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. +// 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); +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. @@ -314,7 +412,6 @@ DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, int link_index, // DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page); - #ifdef __cplusplus } #endif diff --git a/public/fpdf_transformpage.h b/public/fpdf_transformpage.h index 324bcda7f5..21421a18e0 100644 --- a/public/fpdf_transformpage.h +++ b/public/fpdf_transformpage.h @@ -24,9 +24,14 @@ typedef void* FPDF_PAGEARCLOADER; * @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. +* @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); +DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, + float left, + float bottom, + float right, + float top); /** * Set "CropBox" entry to the page dictionary. @@ -36,47 +41,75 @@ DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bo * @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. +* @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); - +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. +* @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. +* @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); +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. +* @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. +* @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); +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. +* 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. +* @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); +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] 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. @@ -85,7 +118,14 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_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); +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. @@ -96,7 +136,10 @@ DLLEXPORT void STDCALL FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object * @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); +DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, + float bottom, + float right, + float top); /** * Destroy the clip path. @@ -108,14 +151,18 @@ DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, float bottom, fl DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath); /** -* Clip the page content, the page content that outside the clipping region become invisible. +* 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. +* @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); +DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, + FPDF_CLIPPATH clipPath); #ifdef __cplusplus } diff --git a/public/fpdfview.h b/public/fpdfview.h index e56071a557..158f8215a4 100644 --- a/public/fpdfview.h +++ b/public/fpdfview.h @@ -25,7 +25,7 @@ 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_PAGEOBJECT; // Page object(text, path, etc) typedef void* FPDF_PATH; typedef void* FPDF_CLIPPATH; typedef void* FPDF_BITMAP; @@ -52,10 +52,10 @@ typedef float FS_FLOAT; // Duplex types typedef enum _FPDF_DUPLEXTYPE_ { - DuplexUndefined = 0, - Simplex, - DuplexFlipShortEdge, - DuplexFlipLongEdge + DuplexUndefined = 0, + Simplex, + DuplexFlipShortEdge, + DuplexFlipLongEdge } FPDF_DUPLEXTYPE; // String types @@ -63,11 +63,13 @@ 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 +// 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. +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_ @@ -75,24 +77,27 @@ typedef const unsigned short* FPDF_WIDESTRING; // Foxit PDF SDK always us * * @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; +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. +// 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; @@ -101,36 +106,34 @@ typedef const char* FPDF_STRING; #endif /** @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.*/ +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; /** @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; +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; #if defined(_WIN32) && defined(FPDFSDK_EXPORTS) // On Windows system, functions are exported in a DLL -#define DLLEXPORT __declspec( dllexport ) +#define DLLEXPORT __declspec(dllexport) #define STDCALL __stdcall #else #define DLLEXPORT @@ -149,7 +152,8 @@ extern "C" { // Return value: // None. // Comments: -// You have to call this function before you can call any PDF processing functions. +// You have to call this function before you can call any PDF +// processing functions. DLLEXPORT void STDCALL FPDF_InitLibrary(); // Function: FPDF_DestroyLibary @@ -159,21 +163,25 @@ DLLEXPORT void STDCALL FPDF_InitLibrary(); // 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. +// 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 +// 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. +// 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); +DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, + FPDF_BOOL enable); // Function: FPDF_LoadDocument // Open and load a PDF document. @@ -187,10 +195,11 @@ DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enabl // Loaded document can be closed by FPDF_CloseDocument(). // If this function fails, you can use FPDF_GetLastError() to retrieve // the reason why it failed. -// The application should call ::FPDF_LoadXFA function after PDF document loaded +// The application should call ::FPDF_LoadXFA function after PDF +// document loaded // to support XFA fields in fpdfformfill.h file. DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, - FPDF_BYTESTRING password); + FPDF_BYTESTRING password); // Function: FPDF_LoadMemDocument // Open and load a PDF document from memory. @@ -207,27 +216,33 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, // 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 +// 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); + 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; + // 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; /** @@ -235,70 +250,77 @@ typedef struct { * * @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); +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; @@ -310,36 +332,41 @@ typedef struct _FPDF_FILEHANDLER // 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. +// 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 +// 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); +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, ... +// 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. +// 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. +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. @@ -348,7 +375,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, int* fileVers // Return value: // A 32-bit integer indicating error codes (defined above). // Comments: -// If the previous SDK call succeeded, the return value of this function +// If the previous SDK call succeeded, the return value of this +// function // is not defined. // DLLEXPORT unsigned long STDCALL FPDF_GetLastError(); @@ -356,27 +384,34 @@ 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. +// 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. +// 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. +// 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. +// 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. +// document - Handle to document. Returned by FPDF_LoadDocument +// function. // Return value: // Total number of pages in the document. // @@ -385,20 +420,24 @@ 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. +// 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 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); +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. +// 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). @@ -408,7 +447,8 @@ 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. +// 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) @@ -418,71 +458,109 @@ 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. +// 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). +// 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); +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. +#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. +// 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. +// 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. +// 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); +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. +// 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. +// 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. +// 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); +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. @@ -505,140 +583,225 @@ 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. +// 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. +// 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 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 +// 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); +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. +// 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. +// 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); +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. +// 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. +// 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. +// 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. +// 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 +// 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); +// 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. +#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. +// 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 +// 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 +// 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); +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. +// 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. +// 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. +// 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); +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. +// 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 +// 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. +// 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); @@ -646,7 +809,8 @@ 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. +// 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); @@ -654,7 +818,8 @@ 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. +// 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: @@ -664,7 +829,8 @@ 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. +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create +// function. // Return value: // None. // Comments: @@ -679,7 +845,8 @@ DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); // Return value: // None. // -DLLEXPORT FPDF_BOOL STDCALL FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); +DLLEXPORT FPDF_BOOL STDCALL +FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); // Function: FPDF_VIEWERREF_GetNumCopies // Returns the number of copies to be printed. @@ -697,16 +864,19 @@ DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); // Return value: // The print page range to be used for printing. // -DLLEXPORT FPDF_PAGERANGE STDCALL FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); +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. +// 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); +DLLEXPORT FPDF_DUPLEXTYPE STDCALL +FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); // Function: FPDF_CountNamedDests // Get the count of named destinations in the PDF document. @@ -724,24 +894,33 @@ DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document); // Return value: // The handle of the dest. // -DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, FPDF_BYTESTRING name); +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. +// 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|. +// 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. +// 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); +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. @@ -749,7 +928,9 @@ 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); +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. |