diff --git a/dependencies/pdfium/win/public/fpdf_dataavail.h b/dependencies/pdfium/win/public/fpdf_dataavail.h index 2413e2be..ad70b7f4 100644 --- a/dependencies/pdfium/win/public/fpdf_dataavail.h +++ b/dependencies/pdfium/win/public/fpdf_dataavail.h @@ -59,14 +59,14 @@ typedef void* FPDF_AVAIL; // // Returns a handle to the document availability provider, or NULL on error. // -// |FPDFAvail_Destroy| must be called when done with the availability provider. -DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, - FPDF_FILEACCESS* file); +// FPDFAvail_Destroy() must be called when done with the availability provider. +FPDF_EXPORT FPDF_AVAIL FPDF_CALLCONV FPDFAvail_Create(FX_FILEAVAIL* file_avail, + FPDF_FILEACCESS* file); // Destroy the |avail| document availability provider. // // avail - handle to document availability provider to be destroyed. -DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail); +FPDF_EXPORT void FPDF_CALLCONV FPDFAvail_Destroy(FPDF_AVAIL avail); // Download hints interface. Used to receive hints for further downloading. typedef struct _FX_DOWNLOADHINTS { @@ -103,11 +103,12 @@ typedef struct _FX_DOWNLOADHINTS { // Applications should call this function whenever new data arrives, and process // all the generated download hints, if any, until the function returns // |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. +// if hints is nullptr, the function just check current document availability. // -// Once all data is available, call |FPDFAvail_GetDocument| to get a document +// Once all data is available, call FPDFAvail_GetDocument() to get a document // handle. -DLLEXPORT int STDCALL -FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints); +FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsDocAvail(FPDF_AVAIL avail, + FX_DOWNLOADHINTS* hints); // Get document from the availability provider. // @@ -116,10 +117,12 @@ FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints); // // Returns a handle to the document. // -// When |FPDFAvail_IsDocAvail| returns TRUE, call |FPDFAvail_GetDocument| to +// When FPDFAvail_IsDocAvail() returns TRUE, call FPDFAvail_GetDocument() to // retrieve the document handle. -DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail, - FPDF_BYTESTRING password); +// See the comments for FPDF_LoadDocument() regarding the encoding for +// |password|. +FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV +FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password); // Get the page number for the first available page in a linearized PDF. // @@ -130,7 +133,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail, // For most linearized PDFs, the first available page will be the first page, // however, some PDFs might make another page the first available page. // For non-linearized PDFs, this function will always return zero. -DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc); +FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc); // Check if |page_index| is ready for loading, if not, get the // |FX_DOWNLOADHINTS|. @@ -145,14 +148,16 @@ DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc); // PDF_DATA_NOTAVAIL: Data not yet available. // PDF_DATA_AVAIL: Data available. // -// This function can be called only after |FPDFAvail_GetDocument| is called. +// This function can be called only after FPDFAvail_GetDocument() is called. // Applications should call this function whenever new data arrives and process // all the generated download |hints|, if any, until this function returns // |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. Applications can then perform page // loading. -DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, - int page_index, - FX_DOWNLOADHINTS* hints); +// if hints is nullptr, the function just check current availability of +// specified page. +FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsPageAvail(FPDF_AVAIL avail, + int page_index, + FX_DOWNLOADHINTS* hints); // Check if form data is ready for initialization, if not, get the // |FX_DOWNLOADHINTS|. @@ -167,14 +172,16 @@ DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, // PDF_FORM_AVAIL: Data available. // PDF_FORM_NOTEXIST: No form data. // -// This function can be called only after |FPDFAvail_GetDocument| is called. +// This function can be called only after FPDFAvail_GetDocument() is called. // The application should call this function whenever new data arrives and // process all the generated download |hints|, if any, until the function // |PDF_FORM_ERROR|, |PDF_FORM_AVAIL| or |PDF_FORM_NOTEXIST|. +// if hints is nullptr, the function just check current form availability. +// // Applications can then perform page loading. It is recommend to call -// |FPDFDOC_InitFormFillEnvironment| when |PDF_FORM_AVAIL| is returned. -DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, - FX_DOWNLOADHINTS* hints); +// FPDFDOC_InitFormFillEnvironment() when |PDF_FORM_AVAIL| is returned. +FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsFormAvail(FPDF_AVAIL avail, + FX_DOWNLOADHINTS* hints); // Check whether a document is a linearized PDF. // @@ -185,11 +192,11 @@ DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, // PDF_NOT_LINEARIZED // PDF_LINEARIZATION_UNKNOWN // -// |FPDFAvail_IsLinearized| will return |PDF_LINEARIZED| or |PDF_NOT_LINEARIZED| +// FPDFAvail_IsLinearized() will return |PDF_LINEARIZED| or |PDF_NOT_LINEARIZED| // when we have 1k of data. If the files size less than 1k, it returns // |PDF_LINEARIZATION_UNKNOWN| as there is insufficient information to determine // if the PDF is linearlized. -DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail); +FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsLinearized(FPDF_AVAIL avail); #ifdef __cplusplus } // extern "C" diff --git a/dependencies/pdfium/win/public/fpdf_doc.h b/dependencies/pdfium/win/public/fpdf_doc.h index 9d55a2e8..f5a270a2 100644 --- a/dependencies/pdfium/win/public/fpdf_doc.h +++ b/dependencies/pdfium/win/public/fpdf_doc.h @@ -25,6 +25,17 @@ extern "C" { // Launch an application or open a file. #define PDFACTION_LAUNCH 4 +// View destination fit types. See pdfmark reference v9, page 48. +#define PDFDEST_VIEW_UNKNOWN_MODE 0 +#define PDFDEST_VIEW_XYZ 1 +#define PDFDEST_VIEW_FIT 2 +#define PDFDEST_VIEW_FITH 3 +#define PDFDEST_VIEW_FITV 4 +#define PDFDEST_VIEW_FITR 5 +#define PDFDEST_VIEW_FITB 6 +#define PDFDEST_VIEW_FITBH 7 +#define PDFDEST_VIEW_FITBV 8 + typedef struct _FS_QUADPOINTSF { FS_FLOAT x1; FS_FLOAT y1; @@ -44,7 +55,7 @@ typedef struct _FS_QUADPOINTSF { // // Returns a handle to the first child of |bookmark| or the first top-level // bookmark item. NULL if no child or top-level bookmark found. -DLLEXPORT FPDF_BOOKMARK STDCALL +FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); // Get the next sibling of |bookmark|. @@ -54,7 +65,7 @@ FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); // // Returns a handle to the next sibling of |bookmark|, or NULL if this is the // last bookmark at this level. -DLLEXPORT FPDF_BOOKMARK STDCALL +FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); // Get the title of |bookmark|. @@ -70,9 +81,10 @@ FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); // Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The // string is terminated by a UTF16 NUL character. If |buflen| is less than the // required length, or |buffer| is NULL, |buffer| will not be modified. -DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, - void* buffer, - unsigned long buflen); +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, + void* buffer, + unsigned long buflen); // Find the bookmark with |title| in |document|. // @@ -81,10 +93,10 @@ DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, // // Returns the handle to the bookmark, or NULL if |title| can't be found. // -// |FPDFBookmark_Find| will always return the first bookmark found even if +// FPDFBookmark_Find() will always return the first bookmark found even if // multiple bookmarks have the same |title|. -DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, - FPDF_WIDESTRING title); +FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV +FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title); // Get the destination associated with |bookmark|. // @@ -93,17 +105,18 @@ DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, // // Returns the handle to the destination data, NULL if no destination is // associated with |bookmark|. -DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, - FPDF_BOOKMARK bookmark); +FPDF_EXPORT FPDF_DEST FPDF_CALLCONV +FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); // Get the action associated with |bookmark|. // // bookmark - handle to the bookmark. // // Returns the handle to the action data, or NULL if no action is associated -// with |bookmark|. When NULL is returned, |FPDFBookmark_GetDest| should be +// with |bookmark|. When NULL is returned, FPDFBookmark_GetDest() should be // called to get the |bookmark| destination data. -DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark); +FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV +FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark); // Get the type of |action|. // @@ -115,7 +128,7 @@ DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark); // PDFACTION_REMOTEGOTO // PDFACTION_URI // PDFACTION_LAUNCH -DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action); +FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION action); // Get the destination of |action|. // @@ -123,54 +136,71 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action); // action - handle to the action. |action| must be a |PDFACTION_GOTO| or // |PDFACTION_REMOTEGOTO|. // -// Returns a handle to the destination data. +// Returns a handle to the destination data, or NULL on error, typically +// because the arguments were bad or the action was of the wrong type. // -// In the case of |PDFACTION_REMOTEGOTO|, you should first call -// |FPDFAction_GetFilePath| then load that document, the document handle from -// that document should pass as |document| to |FPDFAction_GetDest|. -DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, - FPDF_ACTION action); +// In the case of |PDFACTION_REMOTEGOTO|, you must first call +// FPDFAction_GetFilePath(), then load the document at that path, then pass +// the document handle from that document as |document| to FPDFAction_GetDest(). +FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document, + FPDF_ACTION action); -// Get file path of a |PDFACTION_REMOTEGOTO| |action|. +// Get the file path of |action|. // // action - handle to the action. |action| must be a |PDFACTION_LAUNCH| or -// |PDFACTION_REMOTEGOTO| +// |PDFACTION_REMOTEGOTO|. // buffer - a buffer for output the path string. May be NULL. // buflen - the length of the buffer, in bytes. May be 0. // -// Returns the number of bytes in the file path, including the trailing UTF16 -// NUL character. +// Returns the number of bytes in the file path, including the trailing NUL +// character, or 0 on error, typically because the arguments were bad or the +// action was of the wrong type. // -// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. +// Regardless of the platform, the |buffer| is always in UTF-8 encoding. // If |buflen| is less than the returned length, or |buffer| is NULL, |buffer| // will not be modified. -DLLEXPORT unsigned long STDCALL +FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen); -// Get the URI path of a |PDFACTION_URI| |action|. +// Get the URI path of |action|. // // document - handle to the document. // action - handle to the action. Must be a |PDFACTION_URI|. // buffer - a buffer for the path string. May be NULL. // buflen - the length of the buffer, in bytes. May be 0. // -// Returns the number of bytes in the URI path, including trailing zeros. +// Returns the number of bytes in the URI path, including the trailing NUL +// character, or 0 on error, typically because the arguments were bad or the +// action was of the wrong type. // // The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less than the // returned length, or |buffer| is NULL, |buffer| will not be modified. -DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, - FPDF_ACTION action, - void* buffer, - unsigned long buflen); +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDFAction_GetURIPath(FPDF_DOCUMENT document, + FPDF_ACTION action, + void* buffer, + unsigned long buflen); // Get the page index of |dest|. // // document - handle to the document. // dest - handle to the destination. // -// Returns the page index containing |dest|. Page indices start from 0. -DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, - FPDF_DEST dest); +// Returns the 0-based page index containing |dest|. Returns -1 on error. +FPDF_EXPORT int FPDF_CALLCONV FPDFDest_GetDestPageIndex(FPDF_DOCUMENT document, + FPDF_DEST dest); + +// Get the view (fit type) specified by |dest|. +// Experimental API. Subject to change. +// +// dest - handle to the destination. +// pNumParams - receives the number of view parameters, which is at most 4. +// pParams - buffer to write the view parameters. Must be at least 4 +// FS_FLOATs long. +// Returns one of the PDFDEST_VIEW_* constants, PDFDEST_VIEW_UNKNOWN_MODE if +// |dest| does not specify a view. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDFDest_GetView(FPDF_DEST dest, unsigned long* pNumParams, FS_FLOAT* pParams); // Get the (x, y, zoom) location of |dest| in the destination page, if the // destination is in [page /XYZ x y zoom] syntax. @@ -186,13 +216,14 @@ DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, // // Note the [x, y, zoom] values are only set if the corresponding hasXVal, // hasYVal or hasZoomVal flags are true. -DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST dest, - FPDF_BOOL* hasXCoord, - FPDF_BOOL* hasYCoord, - FPDF_BOOL* hasZoom, - FS_FLOAT* x, - FS_FLOAT* y, - FS_FLOAT* zoom); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFDest_GetLocationInPage(FPDF_DEST dest, + FPDF_BOOL* hasXCoord, + FPDF_BOOL* hasYCoord, + FPDF_BOOL* hasZoom, + FS_FLOAT* x, + FS_FLOAT* y, + FS_FLOAT* zoom); // Find a link at point (|x|,|y|) on |page|. // @@ -203,10 +234,10 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST dest, // Returns a handle to the link, or NULL if no link found at the given point. // // You can convert coordinates from screen coordinates to page coordinates using -// |FPDF_DeviceToPage|. -DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, - double x, - double y); +// FPDF_DeviceToPage(). +FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFLink_GetLinkAtPoint(FPDF_PAGE page, + double x, + double y); // Find the Z-order of link at point (|x|,|y|) on |page|. // @@ -218,9 +249,10 @@ DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, // Larger Z-order numbers are closer to the front. // // You can convert coordinates from screen coordinates to page coordinates using -// |FPDF_DeviceToPage|. -DLLEXPORT int STDCALL -FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y); +// FPDF_DeviceToPage(). +FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, + double x, + double y); // Get destination info for |link|. // @@ -228,56 +260,57 @@ FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y); // link - handle to the link. // // Returns a handle to the destination, or NULL if there is no destination -// associated with the link. In this case, you should call |FPDFLink_GetAction| +// associated with the link. In this case, you should call FPDFLink_GetAction() // to retrieve the action associated with |link|. -DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, - FPDF_LINK link); +FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document, + FPDF_LINK link); // Get action info for |link|. // // link - handle to the link. // // Returns a handle to the action associated to |link|, or NULL if no action. -DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link); +FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK link); // Enumerates all the link annotations in |page|. // -// page - handle to the page. -// startPos - the start position, should initially be 0 and is updated with -// the next start position on return. -// linkAnnot - the link handle for |startPos|. +// page - handle to the page. +// start_pos - the start position, should initially be 0 and is updated with +// the next start position on return. +// link_annot - the link handle for |startPos|. // // Returns TRUE on success. -DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, - int* startPos, - FPDF_LINK* linkAnnot); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page, + int* start_pos, + FPDF_LINK* link_annot); -// Get the rectangle for |linkAnnot|. +// Get the rectangle for |link_annot|. // -// linkAnnot - handle to the link annotation. -// rect - the annotation rectangle. +// link_annot - handle to the link annotation. +// rect - the annotation rectangle. // // Returns true on success. -DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, - FS_RECTF* rect); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetAnnotRect(FPDF_LINK link_annot, + FS_RECTF* rect); -// Get the count of quadrilateral points to the |linkAnnot|. +// Get the count of quadrilateral points to the |link_annot|. // -// linkAnnot - handle to the link annotation. +// link_annot - handle to the link annotation. // // Returns the count of quadrilateral points. -DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot); +FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountQuadPoints(FPDF_LINK link_annot); -// Get the quadrilateral points for the specified |quadIndex| in |linkAnnot|. +// Get the quadrilateral points for the specified |quad_index| in |link_annot|. // -// linkAnnot - handle to the link annotation. -// quadIndex - the specified quad point index. -// quadPoints - receives the quadrilateral points. +// link_annot - handle to the link annotation. +// quad_index - the specified quad point index. +// quad_points - receives the quadrilateral points. // // Returns true on success. -DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, - int quadIndex, - FS_QUADPOINTSF* quadPoints); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFLink_GetQuadPoints(FPDF_LINK link_annot, + int quad_index, + FS_QUADPOINTSF* quad_points); // Get meta-data |tag| content from |document|. // @@ -296,10 +329,14 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, // The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two // bytes of zeros indicating the end of the string. If |buflen| is less than // the returned length, or |buffer| is NULL, |buffer| will not be modified. -DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document, - FPDF_BYTESTRING tag, - void* buffer, - unsigned long buflen); +// +// For linearized files, FPDFAvail_IsFormAvail must be called before this, and +// it must have returned PDF_FORM_AVAIL or PDF_FORM_NOTEXIST. Before that, there +// is no guarantee the metadata has been loaded. +FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document, + FPDF_BYTESTRING tag, + void* buffer, + unsigned long buflen); // Get the page label for |page_index| from |document|. // @@ -313,10 +350,11 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document, // The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two // bytes of zeros indicating the end of the string. If |buflen| is less than // the returned length, or |buffer| is NULL, |buffer| will not be modified. -DLLEXPORT unsigned long STDCALL FPDF_GetPageLabel(FPDF_DOCUMENT document, - int page_index, - void* buffer, - unsigned long buflen); +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDF_GetPageLabel(FPDF_DOCUMENT document, + int page_index, + void* buffer, + unsigned long buflen); #ifdef __cplusplus } // extern "C" diff --git a/dependencies/pdfium/win/public/fpdf_edit.h b/dependencies/pdfium/win/public/fpdf_edit.h index 640d97ed..4f384323 100644 --- a/dependencies/pdfium/win/public/fpdf_edit.h +++ b/dependencies/pdfium/win/public/fpdf_edit.h @@ -20,13 +20,83 @@ #define FPDF_GetRValue(argb) ((uint8_t)((argb) >> 16)) #define FPDF_GetAValue(argb) ((uint8_t)((argb) >> 24)) +// Refer to PDF Reference version 1.7 table 4.12 for all color space families. +#define FPDF_COLORSPACE_UNKNOWN 0 +#define FPDF_COLORSPACE_DEVICEGRAY 1 +#define FPDF_COLORSPACE_DEVICERGB 2 +#define FPDF_COLORSPACE_DEVICECMYK 3 +#define FPDF_COLORSPACE_CALGRAY 4 +#define FPDF_COLORSPACE_CALRGB 5 +#define FPDF_COLORSPACE_LAB 6 +#define FPDF_COLORSPACE_ICCBASED 7 +#define FPDF_COLORSPACE_SEPARATION 8 +#define FPDF_COLORSPACE_DEVICEN 9 +#define FPDF_COLORSPACE_INDEXED 10 +#define FPDF_COLORSPACE_PATTERN 11 + // The page object constants. +#define FPDF_PAGEOBJ_UNKNOWN 0 #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 +// The path segment constants. +#define FPDF_SEGMENT_UNKNOWN -1 +#define FPDF_SEGMENT_LINETO 0 +#define FPDF_SEGMENT_BEZIERTO 1 +#define FPDF_SEGMENT_MOVETO 2 + +#define FPDF_FILLMODE_NONE 0 +#define FPDF_FILLMODE_ALTERNATE 1 +#define FPDF_FILLMODE_WINDING 2 + +#define FPDF_FONT_TYPE1 1 +#define FPDF_FONT_TRUETYPE 2 + +#define FPDF_LINECAP_BUTT 0 +#define FPDF_LINECAP_ROUND 1 +#define FPDF_LINECAP_PROJECTING_SQUARE 2 + +#define FPDF_LINEJOIN_MITER 0 +#define FPDF_LINEJOIN_ROUND 1 +#define FPDF_LINEJOIN_BEVEL 2 + +#define FPDF_PRINTMODE_EMF 0 +#define FPDF_PRINTMODE_TEXTONLY 1 +#define FPDF_PRINTMODE_POSTSCRIPT2 2 +#define FPDF_PRINTMODE_POSTSCRIPT3 3 +#define FPDF_PRINTMODE_POSTSCRIPT2_PASSTHROUGH 4 +#define FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH 5 + +#define FPDF_TEXTRENDERMODE_FILL 0 +#define FPDF_TEXTRENDERMODE_STROKE 1 +#define FPDF_TEXTRENDERMODE_FILL_STROKE 2 +#define FPDF_TEXTRENDERMODE_INVISIBLE 3 +#define FPDF_TEXTRENDERMODE_FILL_CLIP 4 +#define FPDF_TEXTRENDERMODE_STROKE_CLIP 5 +#define FPDF_TEXTRENDERMODE_FILL_STROKE_CLIP 6 +#define FPDF_TEXTRENDERMODE_CLIP 7 + +typedef struct FPDF_IMAGEOBJ_METADATA { + // The image width in pixels. + unsigned int width; + // The image height in pixels. + unsigned int height; + // The image's horizontal pixel-per-inch. + float horizontal_dpi; + // The image's vertical pixel-per-inch. + float vertical_dpi; + // The number of bits used to represent each pixel. + unsigned int bits_per_pixel; + // The image's colorspace. See above for the list of FPDF_COLORSPACE_*. + int colorspace; + // The image's marked content ID. Useful for pairing with associated alt-text. + // A value of -1 indicates no ID. + int marked_content_id; +} FPDF_IMAGEOBJ_METADATA; + #ifdef __cplusplus extern "C" { #endif // __cplusplus @@ -34,31 +104,32 @@ extern "C" { // Create a new PDF document. // // Returns a handle to a new document, or NULL on failure. -DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument(); +FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument(); // Create a new PDF page. // // document - handle to document. -// page_index - suggested index of the page to create. If it is larger than -// document's current last index(L), the created page index is -// the next available index -- L+1. -// width - the page width. -// height - the page height. +// page_index - suggested 0-based index of the page to create. If it is larger +// than document's current last index(L), the created page index +// is the next available index -- L+1. +// width - the page width in points. +// height - the page height in points. // -// Returns the handle to the new page. +// Returns the handle to the new page or NULL on failure. // -// The page should be closed with CPDF_ClosePage() when finished as +// The page should be closed with FPDF_ClosePage() when finished as // with any other page in the document. -DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, - int page_index, - double width, - double height); +FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDFPage_New(FPDF_DOCUMENT document, + int page_index, + double width, + double height); // Delete the page at |page_index|. // // document - handle to document. // page_index - the index of the page to delete. -DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index); +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_Delete(FPDF_DOCUMENT document, + int page_index); // Get the rotation of |page|. // @@ -69,7 +140,7 @@ DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index); // 1 - Rotated 90 degrees clockwise. // 2 - Rotated 180 degrees clockwise. // 3 - Rotated 270 degrees clockwise. -DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page); +FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetRotation(FPDF_PAGE page); // Set rotation for |page|. // @@ -79,22 +150,35 @@ DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page); // 1 - Rotated 90 degrees clockwise. // 2 - Rotated 180 degrees clockwise. // 3 - Rotated 270 degrees clockwise. -DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate); +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetRotation(FPDF_PAGE page, int rotate); // Insert |page_obj| into |page|. // // page - handle to a page // page_obj - handle to a page object. The |page_obj| will be automatically // freed. -DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, - FPDF_PAGEOBJECT page_obj); +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertObject(FPDF_PAGE page, + FPDF_PAGEOBJECT page_obj); + +// Experimental API. +// Remove |page_obj| from |page|. +// +// page - handle to a page +// page_obj - handle to a page object to be removed. +// +// Returns TRUE on success. +// +// Ownership is transferred to the caller. Call FPDFPageObj_Destroy() to free +// it. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPage_RemoveObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_obj); // Get number of page objects inside |page|. // // page - handle to a page. // // Returns the number of objects in |page|. -DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page); +FPDF_EXPORT int FPDF_CALLCONV FPDFPage_CountObjects(FPDF_PAGE page); // Get object in |page| at |index|. // @@ -102,14 +186,15 @@ DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page); // index - the index of a page object. // // Returns the handle to the page object, or NULL on failed. -DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index); +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPage_GetObject(FPDF_PAGE page, + int index); // Checks if |page| contains transparency. // // page - handle to a page. // // Returns TRUE if |page| contains transparency. -DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_HasTransparency(FPDF_PAGE page); // Generate the content of |page|. // @@ -119,17 +204,34 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page); // // Before you save the page to a file, or reload the page, you must call // |FPDFPage_GenerateContent| or any changes to |page| will be lost. -DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GenerateContent(FPDF_PAGE page); -// Checks if |pageObject| contains transparency. +// Destroy |page_obj| by releasing its resources. |page_obj| must have been +// created by FPDFPageObj_CreateNew{Path|Rect}() or +// FPDFPageObj_New{Text|Image}Obj(). This function must be called on +// newly-created objects if they are not added to a page through +// FPDFPage_InsertObject() or to an annotation through FPDFAnnot_AppendObject(). // -// pageObject - handle to a page object. +// page_obj - handle to a page object. +FPDF_EXPORT void FPDF_CALLCONV FPDFPageObj_Destroy(FPDF_PAGEOBJECT page_obj); + +// Checks if |page_object| contains transparency. +// +// page_object - handle to a page object. // // Returns TRUE if |pageObject| contains transparency. -DLLEXPORT FPDF_BOOL STDCALL -FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT page_object); -// Transform |pageObject| by the given matrix. +// Get type of |page_object|. +// +// page_object - handle to a page object. +// +// Returns one of the FPDF_PAGEOBJ_* values on success, FPDF_PAGEOBJ_UNKNOWN on +// error. +FPDF_EXPORT int FPDF_CALLCONV FPDFPageObj_GetType(FPDF_PAGEOBJECT page_object); + +// Transform |page_object| by the given matrix. // // page_object - handle to a page object. // a - matrix value. @@ -143,13 +245,14 @@ FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject); // |a c e| // |b d f| // and can be used to scale, rotate, shear and translate the |page_object|. -DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, - double a, - double b, - double c, - double d, - double e, - double f); +FPDF_EXPORT void FPDF_CALLCONV +FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, + double a, + double b, + double c, + double d, + double e, + double f); // Transform all annotations in |page|. // @@ -165,63 +268,327 @@ DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object, // |a c e| // |b d f| // and can be used to scale, rotate, shear and translate the |page| annotations. -DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, - double a, - double b, - double c, - double d, - double e, - double f); +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_TransformAnnots(FPDF_PAGE page, + double a, + double b, + double c, + double d, + double e, + double f); // Create a new image object. // // document - handle to a document. // // Returns a handle to a new image object. -DLLEXPORT FPDF_PAGEOBJECT STDCALL -FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document); +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV +FPDFPageObj_NewImageObj(FPDF_DOCUMENT document); + +// Experimental API. +// Get number of content marks in |page_object|. +// +// page_object - handle to a page object. +// +// Returns the number of content marks in |page_object|, or -1 in case of +// failure. +FPDF_EXPORT int FPDF_CALLCONV +FPDFPageObj_CountMarks(FPDF_PAGEOBJECT page_object); + +// Experimental API. +// Get content mark in |page_object| at |index|. +// +// page_object - handle to a page object. +// index - the index of a page object. +// +// Returns the handle to the content mark, or NULL on failure. The handle is +// still owned by the library, and it should not be freed directly. It becomes +// invalid if the page object is destroyed, either directly or indirectly by +// unloading the page. +FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV +FPDFPageObj_GetMark(FPDF_PAGEOBJECT page_object, unsigned long index); + +// Experimental API. +// Add a new content mark to a |page_object|. +// +// page_object - handle to a page object. +// name - the name (tag) of the mark. +// +// Returns the handle to the content mark, or NULL on failure. The handle is +// still owned by the library, and it should not be freed directly. It becomes +// invalid if the page object is destroyed, either directly or indirectly by +// unloading the page. +FPDF_EXPORT FPDF_PAGEOBJECTMARK FPDF_CALLCONV +FPDFPageObj_AddMark(FPDF_PAGEOBJECT page_object, FPDF_BYTESTRING name); + +// Experimental API. +// Removes a content |mark| from a |page_object|. +// The mark handle will be invalid after the removal. +// +// page_object - handle to a page object. +// mark - handle to a content mark in that object to remove. +// +// Returns TRUE if the operation succeeded, FALSE if it failed. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_RemoveMark(FPDF_PAGEOBJECT page_object, FPDF_PAGEOBJECTMARK mark); + +// Experimental API. +// Get the name of a content mark. +// +// mark - handle to a content mark. +// buffer - buffer for holding the returned name in UTF16-LE. This is only +// modified if |buflen| is longer than the length of the name. +// Optional, pass null to just retrieve the size of the buffer +// needed. +// buflen - length of the buffer. +// out_buflen - pointer to variable that will receive the minimum buffer size +// to contain the name. Not filled if FALSE is returned. +// +// Returns TRUE if the operation succeeded, FALSE if it failed. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_GetName(FPDF_PAGEOBJECTMARK mark, + void* buffer, + unsigned long buflen, + unsigned long* out_buflen); + +// Experimental API. +// Get the number of key/value pair parameters in |mark|. +// +// mark - handle to a content mark. +// +// Returns the number of key/value pair parameters |mark|, or -1 in case of +// failure. +FPDF_EXPORT int FPDF_CALLCONV +FPDFPageObjMark_CountParams(FPDF_PAGEOBJECTMARK mark); + +// Experimental API. +// Get the key of a property in a content mark. +// +// mark - handle to a content mark. +// index - index of the property. +// buffer - buffer for holding the returned key in UTF16-LE. This is only +// modified if |buflen| is longer than the length of the key. +// Optional, pass null to just retrieve the size of the buffer +// needed. +// buflen - length of the buffer. +// out_buflen - pointer to variable that will receive the minimum buffer size +// to contain the key. Not filled if FALSE is returned. +// +// Returns TRUE if the operation was successful, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_GetParamKey(FPDF_PAGEOBJECTMARK mark, + unsigned long index, + void* buffer, + unsigned long buflen, + unsigned long* out_buflen); + +// Experimental API. +// Get the type of the value of a property in a content mark by key. +// +// mark - handle to a content mark. +// key - string key of the property. +// +// Returns the type of the value, or FPDF_OBJECT_UNKNOWN in case of failure. +FPDF_EXPORT FPDF_OBJECT_TYPE FPDF_CALLCONV +FPDFPageObjMark_GetParamValueType(FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key); + +// Experimental API. +// Get the value of a number property in a content mark by key as int. +// FPDFPageObjMark_GetParamValueType() should have returned FPDF_OBJECT_NUMBER +// for this property. +// +// mark - handle to a content mark. +// key - string key of the property. +// out_value - pointer to variable that will receive the value. Not filled if +// false is returned. +// +// Returns TRUE if the key maps to a number value, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_GetParamIntValue(FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key, + int* out_value); + +// Experimental API. +// Get the value of a string property in a content mark by key. +// +// mark - handle to a content mark. +// key - string key of the property. +// buffer - buffer for holding the returned value in UTF16-LE. This is +// only modified if |buflen| is longer than the length of the +// value. +// Optional, pass null to just retrieve the size of the buffer +// needed. +// buflen - length of the buffer. +// out_buflen - pointer to variable that will receive the minimum buffer size +// to contain the value. Not filled if FALSE is returned. +// +// Returns TRUE if the key maps to a string/blob value, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_GetParamStringValue(FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key, + void* buffer, + unsigned long buflen, + unsigned long* out_buflen); + +// Experimental API. +// Get the value of a blob property in a content mark by key. +// +// mark - handle to a content mark. +// key - string key of the property. +// buffer - buffer for holding the returned value. This is only modified +// if |buflen| is at least as long as the length of the value. +// Optional, pass null to just retrieve the size of the buffer +// needed. +// buflen - length of the buffer. +// out_buflen - pointer to variable that will receive the minimum buffer size +// to contain the value. Not filled if FALSE is returned. +// +// Returns TRUE if the key maps to a string/blob value, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_GetParamBlobValue(FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key, + void* buffer, + unsigned long buflen, + unsigned long* out_buflen); + +// Experimental API. +// Set the value of an int property in a content mark by key. If a parameter +// with key |key| exists, its value is set to |value|. Otherwise, it is added as +// a new parameter. +// +// document - handle to the document. +// page_object - handle to the page object with the mark. +// mark - handle to a content mark. +// key - string key of the property. +// value - int value to set. +// +// Returns TRUE if the operation succeeded, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_SetIntParam(FPDF_DOCUMENT document, + FPDF_PAGEOBJECT page_object, + FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key, + int value); + +// Experimental API. +// Set the value of a string property in a content mark by key. If a parameter +// with key |key| exists, its value is set to |value|. Otherwise, it is added as +// a new parameter. +// +// document - handle to the document. +// page_object - handle to the page object with the mark. +// mark - handle to a content mark. +// key - string key of the property. +// value - string value to set. +// +// Returns TRUE if the operation succeeded, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_SetStringParam(FPDF_DOCUMENT document, + FPDF_PAGEOBJECT page_object, + FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key, + FPDF_BYTESTRING value); + +// Experimental API. +// Set the value of a blob property in a content mark by key. If a parameter +// with key |key| exists, its value is set to |value|. Otherwise, it is added as +// a new parameter. +// +// document - handle to the document. +// page_object - handle to the page object with the mark. +// mark - handle to a content mark. +// key - string key of the property. +// value - pointer to blob value to set. +// value_len - size in bytes of |value|. +// +// Returns TRUE if the operation succeeded, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_SetBlobParam(FPDF_DOCUMENT document, + FPDF_PAGEOBJECT page_object, + FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key, + void* value, + unsigned long value_len); + +// Experimental API. +// Removes a property from a content mark by key. +// +// page_object - handle to the page object with the mark. +// mark - handle to a content mark. +// key - string key of the property. +// +// Returns TRUE if the operation succeeded, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObjMark_RemoveParam(FPDF_PAGEOBJECT page_object, + FPDF_PAGEOBJECTMARK mark, + FPDF_BYTESTRING key); // Load an image from a JPEG image file and then set it into |image_object|. // // pages - pointer to the start of all loaded pages, may be NULL. -// nCount - number of |pages|, may be 0. +// count - number of |pages|, may be 0. // image_object - handle to an image object. -// fileAccess - file access handler which specifies the JPEG image file. +// file_access - file access handler which specifies the JPEG image file. // // Returns TRUE on success. // // The image object might already have an associated image, which is shared and // cached by the loaded pages. In that case, we need to clear the cached image -// for all the loaded pages. Pass |pages| and page count (|nCount|) to this API +// for all the loaded pages. Pass |pages| and page count (|count|) to this API // to clear the image cache. If the image is not previously shared, or NULL is a // valid |pages| value. -DLLEXPORT FPDF_BOOL STDCALL +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, - int nCount, + int count, FPDF_PAGEOBJECT image_object, - FPDF_FILEACCESS* fileAccess); + FPDF_FILEACCESS* file_access); // Load an image from a JPEG image file and then set it into |image_object|. // // pages - pointer to the start of all loaded pages, may be NULL. -// nCount - number of |pages|, may be 0. +// count - number of |pages|, may be 0. // image_object - handle to an image object. -// fileAccess - file access handler which specifies the JPEG image file. +// file_access - file access handler which specifies the JPEG image file. // // Returns TRUE on success. // // The image object might already have an associated image, which is shared and // cached by the loaded pages. In that case, we need to clear the cached image -// for all the loaded pages. Pass |pages| and page count (|nCount|) to this API +// for all the loaded pages. Pass |pages| and page count (|count|) to this API // to clear the image cache. If the image is not previously shared, or NULL is a // valid |pages| value. This function loads the JPEG image inline, so the image -// content is copied to the file. This allows |fileAccess| and its associated +// content is copied to the file. This allows |file_access| and its associated // data to be deleted after this function returns. -DLLEXPORT FPDF_BOOL STDCALL +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages, - int nCount, + int count, FPDF_PAGEOBJECT image_object, - FPDF_FILEACCESS* fileAccess); + FPDF_FILEACCESS* file_access); + +// Experimental API. +// Get the transform matrix of an image object. +// +// image_object - handle to an image object. +// a - matrix value. +// b - matrix value. +// c - matrix value. +// d - matrix value. +// e - matrix value. +// f - matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and used to scale, rotate, shear and translate the image. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFImageObj_GetMatrix(FPDF_PAGEOBJECT path, + double* a, + double* b, + double* c, + double* d, + double* e, + double* f); // Set the transform matrix of |image_object|. // @@ -236,29 +603,791 @@ FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages, // The matrix is composed as: // |a c e| // |b d f| -// and can be used to scale, rotate, shear and translate the |page| annotations. +// and can be used to scale, rotate, shear and translate the |image_object|. // // Returns TRUE on success. -DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, - double a, - double b, - double c, - double d, - double e, - double f); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object, + double a, + double b, + double c, + double d, + double e, + double f); // Set |bitmap| to |image_object|. // // pages - pointer to the start of all loaded pages, may be NULL. -// nCount - number of |pages|, may be 0. +// count - number of |pages|, may be 0. // image_object - handle to an image object. // bitmap - handle of the bitmap. // // Returns TRUE on success. -DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, - int nCount, - FPDF_PAGEOBJECT image_object, - FPDF_BITMAP bitmap); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFImageObj_SetBitmap(FPDF_PAGE* pages, + int count, + FPDF_PAGEOBJECT image_object, + FPDF_BITMAP bitmap); + +// Get a bitmap rasterisation of |image_object|. The returned bitmap will be +// owned by the caller, and FPDFBitmap_Destroy() must be called on the returned +// bitmap when it is no longer needed. +// +// image_object - handle to an image object. +// +// Returns the bitmap. +FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV +FPDFImageObj_GetBitmap(FPDF_PAGEOBJECT image_object); + +// Get the decoded image data of |image_object|. The decoded data is the +// uncompressed image data, i.e. the raw image data after having all filters +// applied. |buffer| is only modified if |buflen| is longer than the length of +// the decoded image data. +// +// image_object - handle to an image object. +// buffer - buffer for holding the decoded image data in raw bytes. +// buflen - length of the buffer. +// +// Returns the length of the decoded image data. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDFImageObj_GetImageDataDecoded(FPDF_PAGEOBJECT image_object, + void* buffer, + unsigned long buflen); + +// Get the raw image data of |image_object|. The raw data is the image data as +// stored in the PDF without applying any filters. |buffer| is only modified if +// |buflen| is longer than the length of the raw image data. +// +// image_object - handle to an image object. +// buffer - buffer for holding the raw image data in raw bytes. +// buflen - length of the buffer. +// +// Returns the length of the raw image data. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDFImageObj_GetImageDataRaw(FPDF_PAGEOBJECT image_object, + void* buffer, + unsigned long buflen); + +// Get the number of filters (i.e. decoders) of the image in |image_object|. +// +// image_object - handle to an image object. +// +// Returns the number of |image_object|'s filters. +FPDF_EXPORT int FPDF_CALLCONV +FPDFImageObj_GetImageFilterCount(FPDF_PAGEOBJECT image_object); + +// Get the filter at |index| of |image_object|'s list of filters. Note that the +// filters need to be applied in order, i.e. the first filter should be applied +// first, then the second, etc. |buffer| is only modified if |buflen| is longer +// than the length of the filter string. +// +// image_object - handle to an image object. +// index - the index of the filter requested. +// buffer - buffer for holding filter string, encoded in UTF-8. +// buflen - length of the buffer. +// +// Returns the length of the filter string. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDFImageObj_GetImageFilter(FPDF_PAGEOBJECT image_object, + int index, + void* buffer, + unsigned long buflen); + +// Get the image metadata of |image_object|, including dimension, DPI, bits per +// pixel, and colorspace. If the |image_object| is not an image object or if it +// does not have an image, then the return value will be false. Otherwise, +// failure to retrieve any specific parameter would result in its value being 0. +// +// image_object - handle to an image object. +// page - handle to the page that |image_object| is on. Required for +// retrieving the image's bits per pixel and colorspace. +// metadata - receives the image metadata; must not be NULL. +// +// Returns true if successful. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFImageObj_GetImageMetadata(FPDF_PAGEOBJECT image_object, + FPDF_PAGE page, + FPDF_IMAGEOBJ_METADATA* metadata); + +// Create a new path object at an initial position. +// +// x - initial horizontal position. +// y - initial vertical position. +// +// Returns a handle to a new path object. +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewPath(float x, + float y); + +// Create a closed path consisting of a rectangle. +// +// x - horizontal position for the left boundary of the rectangle. +// y - vertical position for the bottom boundary of the rectangle. +// w - width of the rectangle. +// h - height of the rectangle. +// +// Returns a handle to the new path object. +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewRect(float x, + float y, + float w, + float h); + +// Get the bounding box of |page_object|. +// +// page_object - handle to a page object. +// left - pointer where the left coordinate will be stored +// bottom - pointer where the bottom coordinate will be stored +// right - pointer where the right coordinate will be stored +// top - pointer where the top coordinate will be stored +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_GetBounds(FPDF_PAGEOBJECT page_object, + float* left, + float* bottom, + float* right, + float* top); + +// Set the blend mode of |page_object|. +// +// page_object - handle to a page object. +// blend_mode - string containing the blend mode. +// +// Blend mode can be one of following: Color, ColorBurn, ColorDodge, Darken, +// Difference, Exclusion, HardLight, Hue, Lighten, Luminosity, Multiply, Normal, +// Overlay, Saturation, Screen, SoftLight +FPDF_EXPORT void FPDF_CALLCONV +FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object, + FPDF_BYTESTRING blend_mode); + +// DEPRECATED as of May 2018. This API will be removed in the future. Please +// use FPDFPageObj_SetStrokeColor instead. +// +// Set the stroke RGBA of a path. Range of values: 0 - 255. +// +// path - the handle to the path object. +// R - the red component for the path stroke color. +// G - the green component for the path stroke color. +// B - the blue component for the path stroke color. +// A - the stroke alpha for the path. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPath_SetStrokeColor(FPDF_PAGEOBJECT path, + unsigned int R, + unsigned int G, + unsigned int B, + unsigned int A); + +// Set the stroke RGBA of a page object. Range of values: 0 - 255. +// +// page_object - the handle to the page object. +// R - the red component for the object's stroke color. +// G - the green component for the object's stroke color. +// B - the blue component for the object's stroke color. +// A - the stroke alpha for the object. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_SetStrokeColor(FPDF_PAGEOBJECT page_object, + unsigned int R, + unsigned int G, + unsigned int B, + unsigned int A); + +// DEPRECATED as of May 2018. This API will be removed in the future. Please +// use FPDFPageObj_GetStrokeColor instead. Get the stroke RGBA of a path. +// +// Get the stroke RGBA of a path. Range of values: 0 - 255. +// +// path - the handle to the path object. +// R - the red component of the path stroke color. +// G - the green component of the path stroke color. +// B - the blue component of the path stroke color. +// A - the stroke alpha of the path. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPath_GetStrokeColor(FPDF_PAGEOBJECT path, + unsigned int* R, + unsigned int* G, + unsigned int* B, + unsigned int* A); + +// Get the stroke RGBA of a page object. Range of values: 0 - 255. +// +// page_object - the handle to the page object. +// R - the red component of the path stroke color. +// G - the green component of the object's stroke color. +// B - the blue component of the object's stroke color. +// A - the stroke alpha of the object. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_GetStrokeColor(FPDF_PAGEOBJECT page_object, + unsigned int* R, + unsigned int* G, + unsigned int* B, + unsigned int* A); + +// DEPRECATED as of May 2018. This API will be removed in the future. Please +// use FPDFPageObj_SetStrokeWidth instead. +// +// Set the stroke width of a path. +// +// path - the handle to the path object. +// width - the width of the stroke. +// +// Returns TRUE on success +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width); + +// Set the stroke width of a page object. +// +// path - the handle to the page object. +// width - the width of the stroke. +// +// Returns TRUE on success +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_SetStrokeWidth(FPDF_PAGEOBJECT page_object, float width); + +// Experimental API. +// Get the stroke width of a page object. +// +// path - the handle to the page object. +// width - the width of the stroke. +// +// Returns TRUE on success +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_GetStrokeWidth(FPDF_PAGEOBJECT page_object, float* width); + +// Get the line join of |page_object|. +// +// page_object - handle to a page object. +// +// Returns the line join, or -1 on failure. +// Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND, +// FPDF_LINEJOIN_BEVEL +FPDF_EXPORT int FPDF_CALLCONV +FPDFPageObj_GetLineJoin(FPDF_PAGEOBJECT page_object); + +// DEPRECATED as of May 2018. This API will be removed in the future. Please +// use FPDFPageObj_SetLineJoin instead. +// +// Set the line join of |page_object|. +// +// page_object - handle to a page object. +// line_join - line join +// +// Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND, +// FPDF_LINEJOIN_BEVEL +FPDF_EXPORT void FPDF_CALLCONV FPDFPath_SetLineJoin(FPDF_PAGEOBJECT page_object, + int line_join); + +// Set the line join of |page_object|. +// +// page_object - handle to a page object. +// line_join - line join +// +// Line join can be one of following: FPDF_LINEJOIN_MITER, FPDF_LINEJOIN_ROUND, +// FPDF_LINEJOIN_BEVEL +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_SetLineJoin(FPDF_PAGEOBJECT page_object, int line_join); + +// Get the line cap of |page_object|. +// +// page_object - handle to a page object. +// +// Returns the line cap, or -1 on failure. +// Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND, +// FPDF_LINECAP_PROJECTING_SQUARE +FPDF_EXPORT int FPDF_CALLCONV +FPDFPageObj_GetLineCap(FPDF_PAGEOBJECT page_object); + +// DEPRECATED as of May 2018. This API will be removed in the future. Please +// use FPDFPageObj_SetLineCap instead. +// +// Set the line cap of |page_object|. +// +// page_object - handle to a page object. +// line_cap - line cap +// +// Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND, +// FPDF_LINECAP_PROJECTING_SQUARE +FPDF_EXPORT void FPDF_CALLCONV FPDFPath_SetLineCap(FPDF_PAGEOBJECT page_object, + int line_cap); + +// Set the line cap of |page_object|. +// +// page_object - handle to a page object. +// line_cap - line cap +// +// Line cap can be one of following: FPDF_LINECAP_BUTT, FPDF_LINECAP_ROUND, +// FPDF_LINECAP_PROJECTING_SQUARE +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap); + +// DEPRECATED as of May 2018. This API will be removed in the future. Please +// use FPDFPageObj_SetFillColor instead. +// +// Set the fill RGBA of a path. Range of values: 0 - 255. +// +// path - the handle to the path object. +// R - the red component for the path fill color. +// G - the green component for the path fill color. +// B - the blue component for the path fill color. +// A - the fill alpha for the path. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetFillColor(FPDF_PAGEOBJECT path, + unsigned int R, + unsigned int G, + unsigned int B, + unsigned int A); + +// Set the fill RGBA of a page object. Range of values: 0 - 255. +// +// page_object - the handle to the page object. +// R - the red component for the object's fill color. +// G - the green component for the object's fill color. +// B - the blue component for the object's fill color. +// A - the fill alpha for the object. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object, + unsigned int R, + unsigned int G, + unsigned int B, + unsigned int A); + +// DEPRECATED as of May 2018. This API will be removed in the future. Please +// use FPDFPageObj_GetFillColor instead. +// +// Get the fill RGBA of a path. Range of values: 0 - 255. +// +// path - the handle to the path object. +// R - the red component of the path fill color. +// G - the green component of the path fill color. +// B - the blue component of the path fill color. +// A - the fill alpha of the path. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetFillColor(FPDF_PAGEOBJECT path, + unsigned int* R, + unsigned int* G, + unsigned int* B, + unsigned int* A); + +// Get the fill RGBA of a page object. Range of values: 0 - 255. +// +// page_object - the handle to the page object. +// R - the red component of the object's fill color. +// G - the green component of the object's fill color. +// B - the blue component of the object's fill color. +// A - the fill alpha of the object. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPageObj_GetFillColor(FPDF_PAGEOBJECT page_object, + unsigned int* R, + unsigned int* G, + unsigned int* B, + unsigned int* A); + +// Experimental API. +// Get number of segments inside |path|. +// +// path - handle to a path. +// +// A segment is a command, created by e.g. FPDFPath_MoveTo(), +// FPDFPath_LineTo() or FPDFPath_BezierTo(). +// +// Returns the number of objects in |path| or -1 on failure. +FPDF_EXPORT int FPDF_CALLCONV FPDFPath_CountSegments(FPDF_PAGEOBJECT path); + +// Experimental API. +// Get segment in |path| at |index|. +// +// path - handle to a path. +// index - the index of a segment. +// +// Returns the handle to the segment, or NULL on faiure. +FPDF_EXPORT FPDF_PATHSEGMENT FPDF_CALLCONV +FPDFPath_GetPathSegment(FPDF_PAGEOBJECT path, int index); + +// Experimental API. +// Get coordinates of |segment|. +// +// segment - handle to a segment. +// x - the horizontal position of the segment. +// y - the vertical position of the segment. +// +// Returns TRUE on success, otherwise |x| and |y| is not set. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPathSegment_GetPoint(FPDF_PATHSEGMENT segment, float* x, float* y); + +// Experimental API. +// Get type of |segment|. +// +// segment - handle to a segment. +// +// Returns one of the FPDF_SEGMENT_* values on success, +// FPDF_SEGMENT_UNKNOWN on error. +FPDF_EXPORT int FPDF_CALLCONV FPDFPathSegment_GetType(FPDF_PATHSEGMENT segment); + +// Experimental API. +// Gets if the |segment| closes the current subpath of a given path. +// +// segment - handle to a segment. +// +// Returns close flag for non-NULL segment, FALSE otherwise. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPathSegment_GetClose(FPDF_PATHSEGMENT segment); + +// Move a path's current point. +// +// path - the handle to the path object. +// x - the horizontal position of the new current point. +// y - the vertical position of the new current point. +// +// Note that no line will be created between the previous current point and the +// new one. +// +// Returns TRUE on success +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_MoveTo(FPDF_PAGEOBJECT path, + float x, + float y); + +// Add a line between the current point and a new point in the path. +// +// path - the handle to the path object. +// x - the horizontal position of the new point. +// y - the vertical position of the new point. +// +// The path's current point is changed to (x, y). +// +// Returns TRUE on success +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_LineTo(FPDF_PAGEOBJECT path, + float x, + float y); + +// Add a cubic Bezier curve to the given path, starting at the current point. +// +// path - the handle to the path object. +// x1 - the horizontal position of the first Bezier control point. +// y1 - the vertical position of the first Bezier control point. +// x2 - the horizontal position of the second Bezier control point. +// y2 - the vertical position of the second Bezier control point. +// x3 - the horizontal position of the ending point of the Bezier curve. +// y3 - the vertical position of the ending point of the Bezier curve. +// +// Returns TRUE on success +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_BezierTo(FPDF_PAGEOBJECT path, + float x1, + float y1, + float x2, + float y2, + float x3, + float y3); + +// Close the current subpath of a given path. +// +// path - the handle to the path object. +// +// This will add a line between the current point and the initial point of the +// subpath, thus terminating the current subpath. +// +// Returns TRUE on success +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_Close(FPDF_PAGEOBJECT path); + +// Set the drawing mode of a path. +// +// path - the handle to the path object. +// fillmode - the filling mode to be set: one of the FPDF_FILLMODE_* flags. +// stroke - a boolean specifying if the path should be stroked or not. +// +// Returns TRUE on success +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path, + int fillmode, + FPDF_BOOL stroke); + +// Experimental API. +// Get the drawing mode of a path. +// +// path - the handle to the path object. +// fillmode - the filling mode of the path: one of the FPDF_FILLMODE_* flags. +// stroke - a boolean specifying if the path is stroked or not. +// +// Returns TRUE on success +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetDrawMode(FPDF_PAGEOBJECT path, + int* fillmode, + FPDF_BOOL* stroke); + +// Experimental API. +// Get the transform matrix of a path. +// +// path - handle to a path. +// a - matrix value. +// b - matrix value. +// c - matrix value. +// d - matrix value. +// e - matrix value. +// f - matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and used to scale, rotate, shear and translate the path. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_GetMatrix(FPDF_PAGEOBJECT path, + double* a, + double* b, + double* c, + double* d, + double* e, + double* f); + +// Experimental API. +// Set the transform matrix of a path. +// +// path - handle to a path. +// a - matrix value. +// b - matrix value. +// c - matrix value. +// d - matrix value. +// e - matrix value. +// f - matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and can be used to scale, rotate, shear and translate the path. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetMatrix(FPDF_PAGEOBJECT path, + double a, + double b, + double c, + double d, + double e, + double f); + +// Create a new text object using one of the standard PDF fonts. +// +// document - handle to the document. +// font - string containing the font name, without spaces. +// font_size - the font size for the new text object. +// +// Returns a handle to a new text object, or NULL on failure +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV +FPDFPageObj_NewTextObj(FPDF_DOCUMENT document, + FPDF_BYTESTRING font, + float font_size); + +// Set the text for a textobject. If it had text, it will be replaced. +// +// text_object - handle to the text object. +// text - the UTF-16LE encoded string containing the text to be added. +// +// Returns TRUE on success +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFText_SetText(FPDF_PAGEOBJECT text_object, FPDF_WIDESTRING text); + +// Returns a font object loaded from a stream of data. The font is loaded +// into the document. +// +// document - handle to the document. +// data - the stream of data, which will be copied by the font object. +// size - size of the stream, in bytes. +// font_type - FPDF_FONT_TYPE1 or FPDF_FONT_TRUETYPE depending on the font +// type. +// cid - a boolean specifying if the font is a CID font or not. +// +// The loaded font can be closed using FPDFFont_Close. +// +// Returns NULL on failure +FPDF_EXPORT FPDF_FONT FPDF_CALLCONV FPDFText_LoadFont(FPDF_DOCUMENT document, + const uint8_t* data, + uint32_t size, + int font_type, + FPDF_BOOL cid); + +// Experimental API. +// Loads one of the standard 14 fonts per PDF spec 1.7 page 416. The preferred +// way of using font style is using a dash to separate the name from the style, +// for example 'Helvetica-BoldItalic'. +// +// document - handle to the document. +// font - string containing the font name, without spaces. +// +// The loaded font should NOT be closed using FPDFFont_Close. It will be +// unloaded during the document's destruction. +// +// Returns NULL on failure. +FPDF_EXPORT FPDF_FONT FPDF_CALLCONV +FPDFText_LoadStandardFont(FPDF_DOCUMENT document, FPDF_BYTESTRING font); + +// DEPRECATED as of May 2018. This API will be removed in the future. Please +// use FPDFPageObj_SetFillColor instead. +// +// Set the fill RGBA of a text object. Range of values: 0 - 255. +// +// text_object - handle to the text object. +// R - the red component for the path fill color. +// G - the green component for the path fill color. +// B - the blue component for the path fill color. +// A - the fill alpha for the path. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFText_SetFillColor(FPDF_PAGEOBJECT text_object, + unsigned int R, + unsigned int G, + unsigned int B, + unsigned int A); + +// Experimental API. +// Get the transform matrix of a text object. +// +// text - handle to a text. +// a - matrix value. +// b - matrix value. +// c - matrix value. +// d - matrix value. +// e - matrix value. +// f - matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and used to scale, rotate, shear and translate the text. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_PAGEOBJECT text, + double* a, + double* b, + double* c, + double* d, + double* e, + double* f); + +// Experimental API. +// Get the font size of a text object. +// +// text - handle to a text. +// +// Returns the font size of the text object, measured in points (about 1/72 +// inch) on success; 0 on failure. +FPDF_EXPORT double FPDF_CALLCONV FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text); + +// Close a loaded PDF font. +// +// font - Handle to the loaded font. +FPDF_EXPORT void FPDF_CALLCONV FPDFFont_Close(FPDF_FONT font); + +// Create a new text object using a loaded font. +// +// document - handle to the document. +// font - handle to the font object. +// font_size - the font size for the new text object. +// +// Returns a handle to a new text object, or NULL on failure +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV +FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document, + FPDF_FONT font, + float font_size); + +// Experimental API. +// Get the text rendering mode of a text object. +// +// text - the handle to the text object. +// +// Returns one of the FPDF_TEXTRENDERMODE_* flags on success, -1 on error. +FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT text); + +// Experimental API. +// Get the font name of a text object. +// +// text - the handle to the text object. +// buffer - the address of a buffer that receives the font name. +// length - the size, in bytes, of |buffer|. +// +// Returns the number of bytes in the font name (including the trailing NUL +// character) on success, 0 on error. +// +// Regardless of the platform, the |buffer| is always in UTF-8 encoding. +// If |length| is less than the returned length, or |buffer| is NULL, |buffer| +// will not be modified. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text, + void* buffer, + unsigned long length); + +// Experimental API. +// Get the text of a text object. +// +// text_object - the handle to the text object. +// text_page - the handle to the text page. +// buffer - the address of a buffer that receives the text. +// length - the size, in bytes, of |buffer|. +// +// Returns the number of bytes in the text (including the trailing NUL +// character) on success, 0 on error. +// +// Regardless of the platform, the |buffer| is always in UTF16-LE encoding. +// If |length| is less than the returned length, or |buffer| is NULL, |buffer| +// will not be modified. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object, + FPDF_TEXTPAGE text_page, + void* buffer, + unsigned long length); + +// Experimental API. +// Get number of page objects inside |form_object|. +// +// form_object - handle to a form object. +// +// Returns the number of objects in |form_object| on success, -1 on error. +FPDF_EXPORT int FPDF_CALLCONV +FPDFFormObj_CountObjects(FPDF_PAGEOBJECT form_object); + +// Experimental API. +// Get page object in |form_object| at |index|. +// +// form_object - handle to a form object. +// index - the 0-based index of a page object. +// +// Returns the handle to the page object, or NULL on error. +FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV +FPDFFormObj_GetObject(FPDF_PAGEOBJECT form_object, unsigned long index); + +// Experimental API. +// Get the transform matrix of a form object. +// +// form_object - handle to a form. +// a - pointer to out variable to receive matrix value. +// b - pointer to out variable to receive matrix value. +// c - pointer to out variable to receive matrix value. +// d - pointer to out variable to receive matrix value. +// e - pointer to out variable to receive matrix value. +// f - pointer to out variable to receive matrix value. +// +// The matrix is composed as: +// |a c e| +// |b d f| +// and used to scale, rotate, shear and translate the form object. +// +// Returns TRUE on success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFFormObj_GetMatrix(FPDF_PAGEOBJECT form_object, + double* a, + double* b, + double* c, + double* d, + double* e, + double* f); #ifdef __cplusplus } // extern "C" diff --git a/dependencies/pdfium/win/public/fpdf_ext.h b/dependencies/pdfium/win/public/fpdf_ext.h index 34658789..b1784dd6 100644 --- a/dependencies/pdfium/win/public/fpdf_ext.h +++ b/dependencies/pdfium/win/public/fpdf_ext.h @@ -7,6 +7,8 @@ #ifndef PUBLIC_FPDF_EXT_H_ #define PUBLIC_FPDF_EXT_H_ +#include + // NOLINTNEXTLINE(build/include) #include "fpdfview.h" @@ -64,9 +66,28 @@ typedef struct _UNSUPPORT_INFO { // unsp_info - Pointer to an UNSUPPORT_INFO structure. // // Returns TRUE on success. -DLLEXPORT FPDF_BOOL STDCALL +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info); +// Set replacement function for calls to time(). +// +// This API is intended to be used only for testing, thus may cause PDFium to +// behave poorly in production environments. +// +// func - Function pointer to alternate implementation of time(), or +// NULL to restore to actual time() call itself. +FPDF_EXPORT void FPDF_CALLCONV FSDK_SetTimeFunction(time_t (*func)()); + +// Set replacement function for calls to localtime(). +// +// This API is intended to be used only for testing, thus may cause PDFium to +// behave poorly in production environments. +// +// func - Function pointer to alternate implementation of localtime(), or +// NULL to restore to actual localtime() call itself. +FPDF_EXPORT void FPDF_CALLCONV +FSDK_SetLocaltimeFunction(struct tm* (*func)(const time_t*)); + // Unknown page mode. #define PAGEMODE_UNKNOWN -1 // Document outline, and thumbnails hidden. @@ -89,7 +110,7 @@ FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info); // Returns one of the |PAGEMODE_*| flags defined above. // // The page mode defines how the document should be initially displayed. -DLLEXPORT int STDCALL FPDFDoc_GetPageMode(FPDF_DOCUMENT document); +FPDF_EXPORT int FPDF_CALLCONV FPDFDoc_GetPageMode(FPDF_DOCUMENT document); #ifdef __cplusplus } // extern "C" diff --git a/dependencies/pdfium/win/public/fpdf_flatten.h b/dependencies/pdfium/win/public/fpdf_flatten.h index c1e354e9..614540e1 100644 --- a/dependencies/pdfium/win/public/fpdf_flatten.h +++ b/dependencies/pdfium/win/public/fpdf_flatten.h @@ -35,7 +35,7 @@ extern "C" { // // Currently, all failures return |FLATTEN_FAIL| with no indication of the // cause. -DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag); +FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag); #ifdef __cplusplus } // extern "C" diff --git a/dependencies/pdfium/win/public/fpdf_formfill.h b/dependencies/pdfium/win/public/fpdf_formfill.h index 09b80eaf..4bedfb58 100644 --- a/dependencies/pdfium/win/public/fpdf_formfill.h +++ b/dependencies/pdfium/win/public/fpdf_formfill.h @@ -10,13 +10,39 @@ // NOLINTNEXTLINE(build/include) #include "fpdfview.h" -typedef void* FPDF_FORMHANDLE; +// These values are return values for a public API, so should not be changed +// other than the count when adding new values. +#define FORMTYPE_NONE 0 // Document contains no forms +#define FORMTYPE_ACRO_FORM 1 // Forms are specified using AcroForm spec +#define FORMTYPE_XFA_FULL 2 // Forms are specified using the entire XFA + // spec +#define FORMTYPE_XFA_FOREGROUND 3 // Forms are specified using the XFAF subset + // of XFA spec +#define FORMTYPE_COUNT 4 // The number of form types -#ifdef PDF_ENABLE_XFA -#define DOCTYPE_PDF 0 // Normal pdf Document -#define DOCTYPE_DYNAMIC_XFA 1 // Dynamic xfa Document Type -#define DOCTYPE_STATIC_XFA 2 // Static xfa Document Type -#endif // PDF_ENABLE_XFA +#define JSPLATFORM_ALERT_BUTTON_OK 0 // OK button +#define JSPLATFORM_ALERT_BUTTON_OKCANCEL 1 // OK & Cancel buttons +#define JSPLATFORM_ALERT_BUTTON_YESNO 2 // Yes & No buttons +#define JSPLATFORM_ALERT_BUTTON_YESNOCANCEL 3 // Yes, No & Cancel buttons +#define JSPLATFORM_ALERT_BUTTON_DEFAULT JSPLATFORM_ALERT_BUTTON_OK + +#define JSPLATFORM_ALERT_ICON_ERROR 0 // Error +#define JSPLATFORM_ALERT_ICON_WARNING 1 // Warning +#define JSPLATFORM_ALERT_ICON_QUESTION 2 // Question +#define JSPLATFORM_ALERT_ICON_STATUS 3 // Status +#define JSPLATFORM_ALERT_ICON_ASTERISK 4 // Asterisk +#define JSPLATFORM_ALERT_ICON_DEFAULT JSPLATFORM_ALERT_ICON_ERROR + +#define JSPLATFORM_ALERT_RETURN_OK 1 // OK +#define JSPLATFORM_ALERT_RETURN_CANCEL 2 // Cancel +#define JSPLATFORM_ALERT_RETURN_NO 3 // No +#define JSPLATFORM_ALERT_RETURN_YES 4 // Yes + +#define JSPLATFORM_BEEP_ERROR 0 // Error +#define JSPLATFORM_BEEP_WARNING 1 // Warning +#define JSPLATFORM_BEEP_QUESTION 2 // Question +#define JSPLATFORM_BEEP_STATUS 3 // Status +#define JSPLATFORM_BEEP_DEFAULT 4 // Default // Exported Functions #ifdef __cplusplus @@ -32,34 +58,25 @@ typedef struct _IPDF_JsPlatform { /* 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; - */ + * 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 type of button group, see + * JSPLATFORM_ALERT_BUTTON_* above. + * nIcon - The icon type, see see + * JSPLATFORM_ALERT_ICON_* above . + * + * Return Value: + * Option selected by user in dialogue, see + * JSPLATFORM_ALERT_RETURN_* above. + */ int (*app_alert)(struct _IPDF_JsPlatform* pThis, FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, @@ -67,23 +84,20 @@ typedef struct _IPDF_JsPlatform { 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 - */ + * 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, see see JSPLATFORM_BEEP_TYPE_* + * above. + * + * Return Value: + * None + */ void (*app_beep)(struct _IPDF_JsPlatform* pThis, int nType); /** @@ -382,49 +396,48 @@ typedef struct _FPDF_FORMFILLINFO { /* Version 1. */ /** - *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 + * Method: Release + * Give the implementation a chance to release any resources after the + * interface is no longer used. + * Interface Version: + * 1 + * Implementation Required: + * No + * Comments: + * Called by PDFium 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. + * Invalidate the client area within the specified rectangle. * Interface Version: - * 1 + * 1 * Implementation Required: - * yes + * 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. + * pThis - Pointer to the interface structure itself. + * page - Handle to the page. Returned by FPDF_LoadPage(). + * left - Left position of the client area in PDF page + * coordinates. + * top - Top position of the client area in PDF page + * coordinates. + * right - Right position of the client area in PDF page + * coordinates. + * bottom - Bottom position of the client area in PDF page + * coordinates. * Return Value: - * None. + * None. * - *comments: - * All positions are measured in PDF "user space". - * Implementation should call FPDF_RenderPageBitmap() function for - *repainting a specified page area. - */ + * Comments: + * All positions are measured in PDF "user space". + * Implementation should call FPDF_RenderPageBitmap() for repainting the + * specified page area. + */ void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, double left, @@ -434,36 +447,34 @@ typedef struct _FPDF_FORMFILLINFO { /** * 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. + * When the user selects text in form fields with the mouse, this + * callback function will be invoked with the selected areas. * * Interface Version: - * 1 + * 1 * Implementation Required: - * No + * 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. + * pThis - Pointer to the interface structure itself. + * page - Handle to the page. Returned by FPDF_LoadPage()/ + * left - Left position of the client area in PDF page + * coordinates. + * top - Top position of the client area in PDF page + * coordinates. + * right - Right position of the client area in PDF page + * coordinates. + * bottom - Bottom position of the client area in PDF page + * coordinates. * Return Value: - * None. + * 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. - */ + * Comments: + * This callback function is useful for implementing special text + * selection effects. An implementation should first record the returned + * rectangles, then draw them one by one during the next painting period. + * Lastly, it should remove all the recorded rectangles when finished + * painting. + */ void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, double left, @@ -472,238 +483,248 @@ typedef struct _FPDF_FORMFILLINFO { 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. - * */ + * 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. An interval value is specified, - * and every time that interval elapses, the system must call into the - * callback function with the timer ID as returned by this 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. - * */ + * Method: FFI_SetTimer + * This method installs a system timer. An interval value is specified, + * and every time that interval elapses, the system must call into the + * callback function with the timer ID as returned by this 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 uninstalls a system timer identified by nIDEvent, as - * 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 returned by FFI_SetTimer function. - * Return value: - * None. - * */ + * Method: FFI_KillTimer + * This method uninstalls a system timer, as 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 returned 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. - * */ + * 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: + * The local time. See FPDF_SYSTEMTIME above for details. + * Note: Unused. + */ 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. - * */ + * Method: FFI_OnChange + * This method will be invoked to notify the 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. - * */ + * Method: FFI_GetPage + * This method receives the page handle 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(). + * nPageIndex - Index number of the page. 0 for the first page. + * Return value: + * Handle to the page, as previously returned to the implementation by + * FPDF_LoadPage(). + * Comments: + * The implementation is expected to keep track of the page handles it + * receives from PDFium, and their mappings to page numbers. + * 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, the implementation need to load the page. + */ 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. - * */ + * Method: FFI_GetCurrentPage + * This method receives the handle to 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(). + * Return value: + * Handle to the page. Returned by FPDF_LoadPage(). + * Comments: + * The implementation is expected to keep track of the current page. e.g. + * The current page can be the one that is most visible on screen. + */ 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. - * - * Note: Unused. - * */ + * 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: + * A number to indicate the page rotation in 90 degree increments in a + * clockwise direction: + * 0 - 0 degrees + * 1 - 90 degrees + * 2 - 180 degrees + * 3 - 270 degrees + * Note: Unused. + */ 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 <> - * for more details. - * */ + * Method: FFI_ExecuteNamedAction + * This method will execute a 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 <> + * 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. - * */ + * Method: FFI_SetTextFieldFocus + * Called when a text field is getting or losing focus. + * Interface Version: + * 1 + * Implementation Required: + * no + * Parameters: + * pThis - Pointer to the interface structure itself. + * value - The string value of the form field, in UTF-16LE + * format. + * valueLen - The length of the string value. This is the number + * of characters, not bytes. + * is_focus - True if the form field is getting focus, False if + * the form field is losing focus. + * Return value: + * None. + * Comments: + * Only supports text fields and combobox fields. + */ 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 <> for - * more details. - * */ + * Method: FFI_DoURIAction + * Ask the implementation to navigate 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 <> 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 below. - * fPosArray - The float array which carries the position info. - * sizeofArray - The size of float array. - * - * PDFZoom values: - * - XYZ = 1 - * - FITPAGE = 2 - * - FITHORZ = 3 - * - FITVERT = 4 - * - FITRECT = 5 - * - FITBBOX = 6 - * - FITBHORZ = 7 - * - FITBVERT = 8 - * - * Return value: - * None. - * Comments: - * See the Destinations description of <> in - *8.2.1 for more details. - **/ + * 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 below. + * fPosArray - The float array which carries the position info. + * sizeofArray - The size of float array. + * + * PDFZoom values: + * - XYZ = 1 + * - FITPAGE = 2 + * - FITHORZ = 3 + * - FITVERT = 4 + * - FITRECT = 5 + * - FITBBOX = 6 + * - FITBHORZ = 7 + * - FITBVERT = 8 + * + * Return value: + * None. + * Comments: + * See the Destinations description of <> in + * 8.2.1 for more details. + */ void (*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis, int nPageIndex, int zoomMode, @@ -711,34 +732,35 @@ typedef struct _FPDF_FORMFILLINFO { int sizeofArray); /** - * pointer to IPDF_JSPLATFORM interface - **/ + * Pointer to IPDF_JSPLATFORM interface. + * Unused if PDFium is built without V8 support. Otherwise, if NULL, then + * JavaScript will be prevented from executing while rendering the document. + **/ IPDF_JSPLATFORM* m_pJsPlatform; #ifdef PDF_ENABLE_XFA /* Version 2. */ /** - * Method: FFI_DisplayCaret - * This method will show the caret at specified position. - * Interface Version: - * 2 - * Implementation Required: - * yes - * Parameters: - * pThis - Pointer to the interface structure itself. - * page - Handle to page. Returned by FPDF_LoadPage - *function. - * left - Left position of the client area in PDF page - *coordinate. - * top - Top position of the client area in PDF page - *coordinate. - * right - Right position of the client area in PDF page - *coordinate. - * bottom - Bottom position of the client area in PDF page - *coordinate. - * Return value: - * None. - **/ + * Method: FFI_DisplayCaret + * This method will show the caret at specified position. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage(). + * left - Left position of the client area in PDF page + * coordinates. + * top - Top position of the client area in PDF page + * coordinates. + * right - Right position of the client area in PDF page + * coordinates. + * bottom - Bottom position of the client area in PDF page + * coordinates. + * Return value: + * None. + */ void (*FFI_DisplayCaret)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_BOOL bVisible, @@ -803,27 +825,26 @@ typedef struct _FPDF_FORMFILLINFO { FPDF_WIDESTRING wsURL); /** - * Method: FFI_GetPageViewRect - * This method will get the current page view rectangle. - * Interface Version: - * 2 - * 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. - **/ + * Method: FFI_GetPageViewRect + * This method will get the current page view rectangle. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage(). + * left - The pointer to receive left position of the page + * view area in PDF page coordinates. + * top - The pointer to receive top position of the page + * view area in PDF page coordinates. + * right - The pointer to receive right position of the page + * view area in PDF page coordinates. + * bottom - The pointer to receive bottom position of the page + * view area in PDF page coordinates. + * Return value: + * None. + */ void (*FFI_GetPageViewRect)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, double* left, @@ -859,26 +880,26 @@ typedef struct _FPDF_FORMFILLINFO { FPDF_DWORD event_type); /** - * Method: FFI_PopupMenu - * This method will track the right context menu for XFA fields. - * Interface Version: - * 2 - * 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_MENU_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. - **/ + * Method: FFI_PopupMenu + * This method will track the right context menu for XFA fields. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage(). + * hWidget - Handle to XFA fields. + * menuFlag - The menu flags. Please refer to macro definition + * of FXFA_MENU_XXX and this can be one or a + * combination of these macros. + * x - X position of the client area in PDF page + * coordinates. + * y - Y position of the client area in PDF page + * coordinates. + * Return value: + * TRUE indicates success; otherwise false. + */ FPDF_BOOL (*FFI_PopupMenu)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page, FPDF_WIDGET hWidget, @@ -1081,7 +1102,7 @@ typedef struct _FPDF_FORMFILLINFO { * Return Value: * Return handler to the form fill module. NULL means fails. **/ -DLLEXPORT FPDF_FORMHANDLE STDCALL +FPDF_EXPORT FPDF_FORMHANDLE FPDF_CALLCONV FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, FPDF_FORMFILLINFO* formInfo); @@ -1094,7 +1115,8 @@ FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, * Return Value: * NULL. **/ -DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle); +FPDF_EXPORT void FPDF_CALLCONV +FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle); /** * Function: FORM_OnAfterLoadPage @@ -1108,8 +1130,8 @@ DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle); * Return Value: * NONE. **/ -DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, - FPDF_FORMHANDLE hHandle); +FPDF_EXPORT void FPDF_CALLCONV FORM_OnAfterLoadPage(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle); /** * Function: FORM_OnBeforeClosePage @@ -1124,8 +1146,8 @@ DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, * Return Value: * NONE. **/ -DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, - FPDF_FORMHANDLE hHandle); +FPDF_EXPORT void FPDF_CALLCONV FORM_OnBeforeClosePage(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle); /** * Function: FORM_DoDocumentJSAction @@ -1142,7 +1164,7 @@ DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, *document, this method will execute the javascript action; * otherwise, the method will do nothing. **/ -DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle); +FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle); /** * Function: FORM_DoDocumentOpenAction @@ -1157,65 +1179,65 @@ DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle); * This method will do nothing if there is no open-actions embedded in *the document. **/ -DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle); +FPDF_EXPORT void FPDF_CALLCONV +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. +// Additional actions type of document: +// WC, before closing document, JavaScript action. +// WS, before saving document, JavaScript action. +// DS, after saving document, JavaScript action. +// WP, before printing document, JavaScript action. +// DP, after printing document, JavaScript action. +#define FPDFDOC_AACTION_WC 0x10 +#define FPDFDOC_AACTION_WS 0x11 +#define FPDFDOC_AACTION_DS 0x12 +#define FPDFDOC_AACTION_WP 0x13 +#define FPDFDOC_AACTION_DP 0x14 /** -* Function: FORM_DoDocumentAAction -* This method is required for performing the document's -*additional-action. -* Parameters: -* hHandle - Handle to the form fill module. Returned by -*FPDFDOC_InitFormFillEnvironment. -* aaType - The type of the additional-actions which defined -*above. -* Return Value: -* NONE -* Comments: -* This method will do nothing if there is no document -*additional-action corresponding to the specified aaType. -**/ + * Function: FORM_DoDocumentAAction + * This method is required for performing the document's + * additional-action. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * aaType - The type of the additional-actions which defined + * above. + * Return Value: + * NONE + * Comments: + * This method will do nothing if there is no document + * additional-action corresponding to the specified aaType. + **/ +FPDF_EXPORT void FPDF_CALLCONV 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 +// Additional-action types of page object: +// OPEN (/O) -- An action to be performed when the page is opened +// CLOSE (/C) -- An action to be performed when the page is closed +#define FPDFPAGE_AACTION_OPEN 0 +#define FPDFPAGE_AACTION_CLOSE 1 /** -* Function: FORM_DoPageAAction -* This method is required for performing the page object's -*additional-action when opened or closed. -* Parameters: -* page - Handle to the page. Returned by FPDF_LoadPage -*function. -* hHandle - Handle to the form fill module. Returned by -*FPDFDOC_InitFormFillEnvironment. -* aaType - The type of the page object's additional-actions -*which defined above. -* Return Value: -* NONE -* Comments: -* This method will do nothing if no additional-action corresponding to -*the specified aaType exists. -**/ -DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, - FPDF_FORMHANDLE hHandle, - int aaType); + * Function: FORM_DoPageAAction + * This method is required for performing the page object's + * additional-action when opened or closed. + * Parameters: + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * aaType - The type of the page object's additional-actions + * which defined above. + * Return Value: + * NONE + * Comments: + * This method will do nothing if no additional-action corresponding + * to the specified aaType exists. + **/ +FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle, + int aaType); /** * Function: FORM_OnMouseMove @@ -1233,42 +1255,65 @@ DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, * 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); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +/** + * Function: FORM_OnFocus + * This function focuses the form annotation at a given point. If the + * annotation at the point already has focus, nothing happens. If there + * is no annotation at the point, remove form focus. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in PDF user + * space. + * page_y - Specifies the y-coordinate of the cursor in PDF user + * space. + * Return Value: + * TRUE if there is an annotation at the given point and it has focus. + **/ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnFocus(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. + * mouse button. * Parameters: * hHandle - Handle to the form fill module. Returned by - *FPDFDOC_InitFormFillEnvironment. + * FPDFDOC_InitFormFillEnvironment(). * page - Handle to the page. Returned by FPDF_LoadPage - *function. - * modifier - Indicates whether various virtual keys are down. + * function. + * modifier - Indicates whether various virtual keys are down. * page_x - Specifies the x-coordinate of the cursor in PDF user - *space. + * space. * page_y - Specifies the y-coordinate of the cursor in PDF user - *space. + * 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); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 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. + * mouse button. * Parameters: * hHandle - Handle to the form fill module. Returned by - *FPDFDOC_InitFormFillEnvironment. + * FPDFDOC_InitFormFillEnvironment(). * page - Handle to the page. Returned by FPDF_LoadPage *function. * modifier - Indicates whether various virtual keys are down. @@ -1277,23 +1322,47 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, * 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); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +/** + * Function: FORM_OnLButtonDoubleClick + * You can call this member function when the user double clicks the + * left mouse button. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment(). + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in PDF user + * space. + * page_y - Specifies the y-coordinate of the cursor in PDF user + * space. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FORM_OnLButtonDoubleClick(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); #ifdef PDF_ENABLE_XFA -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); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); #endif // PDF_ENABLE_XFA /** @@ -1310,10 +1379,10 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, * Return Value: * TRUE indicates success; otherwise false. **/ -DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, - FPDF_PAGE page, - int nKeyCode, - int modifier); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nKeyCode, + int modifier); /** * Function: FORM_OnKeyUp @@ -1329,10 +1398,10 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, * Return Value: * TRUE indicates success; otherwise false. **/ -DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, - FPDF_PAGE page, - int nKeyCode, - int modifier); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nKeyCode, + int modifier); /** * Function: FORM_OnChar @@ -1349,10 +1418,136 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, * Return Value: * TRUE indicates success; otherwise false. **/ -DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle, - FPDF_PAGE page, - int nChar, - int modifier); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnChar(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nChar, + int modifier); + +/** + * Experimental API + * Function: FORM_GetFocusedText + * You can call this function to obtain the text within the current + * focused field, if any. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * buffer - Buffer for holding the form text, encoded in + * UTF16-LE. If NULL, |buffer| is not modified. + * buflen - Length of |buffer| in bytes. If |buflen| is less + than the length of the form text string, |buffer| is + not modified. + * Return Value: + * Length in bytes for the text in the focused field. + **/ +FPDF_EXPORT unsigned long FPDF_CALLCONV +FORM_GetFocusedText(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + void* buffer, + unsigned long buflen); + +/** + * Function: FORM_GetSelectedText + * You can call this function to obtain selected text within + * a form text field or form combobox text field. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * buffer - Buffer for holding the selected text, encoded in + * UTF16-LE. If NULL, |buffer| is not modified. + * buflen - Length of |buffer| in bytes. If |buflen| is less + than the length of the selected text string, + |buffer| is not modified. + * Return Value: + * Length in bytes of selected text in form text field or form combobox + * text field. + **/ +FPDF_EXPORT unsigned long FPDF_CALLCONV +FORM_GetSelectedText(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + void* buffer, + unsigned long buflen); + +/** + * Function: FORM_ReplaceSelection + * You can call this function to replace the selected text in a form + * text field or user-editable form combobox text field with another + * text string (which can be empty or non-empty). If there is no + * selected text, this function will append the replacement text after + * the current caret position. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * wsText - The text to be inserted, in UTF-16LE format. + * Return Value: + * None. + **/ +FPDF_EXPORT void FPDF_CALLCONV FORM_ReplaceSelection(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + FPDF_WIDESTRING wsText); + +/** + * Function: FORM_CanUndo + * Find out if it is possible for the current focused widget in a given + * form to perform an undo operation. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * Return Value: + * True if it is possible to undo. + **/ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanUndo(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page); + +/** + * Function: FORM_CanRedo + * Find out if it is possible for the current focused widget in a given + * form to perform a redo operation. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * Return Value: + * True if it is possible to redo. + **/ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanRedo(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page); + +/** + * Function: FORM_Undo + * Make the current focussed widget perform an undo operation. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * Return Value: + * True if the undo operation succeeded. + **/ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Undo(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page); + +/** + * Function: FORM_Redo + * Make the current focussed widget perform a redo operation. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * Return Value: + * True if the redo operation succeeded. + **/ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Redo(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page); /** * Function: FORM_ForceToKillFocus. @@ -1366,9 +1561,12 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle, * Return Value: * TRUE indicates success; otherwise false. **/ -DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle); -// Field Types +// Form Field Types +// The names of the defines are stable, but the specific values associated with +// them are not, so do not hardcode their values. #define FPDF_FORMFIELD_UNKNOWN 0 // Unknown. #define FPDF_FORMFIELD_PUSHBUTTON 1 // push button type. #define FPDF_FORMFIELD_CHECKBOX 2 // check box type. @@ -1376,8 +1574,34 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle); #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_SIGNATURE 7 // text field type. #ifdef PDF_ENABLE_XFA -#define FPDF_FORMFIELD_XFA 7 // text field type. +#define FPDF_FORMFIELD_XFA 8 // Generic XFA type. +#define FPDF_FORMFIELD_XFA_CHECKBOX 9 // XFA check box type. +#define FPDF_FORMFIELD_XFA_COMBOBOX 10 // XFA combo box type. +#define FPDF_FORMFIELD_XFA_IMAGEFIELD 11 // XFA image field type. +#define FPDF_FORMFIELD_XFA_LISTBOX 12 // XFA list box type. +#define FPDF_FORMFIELD_XFA_PUSHBUTTON 13 // XFA push button type. +#define FPDF_FORMFIELD_XFA_SIGNATURE 14 // XFA signture field type. +#define FPDF_FORMFIELD_XFA_TEXTFIELD 15 // XFA text field type. +#endif // PDF_ENABLE_XFA + +#ifdef PDF_ENABLE_XFA +#define FPDF_FORMFIELD_COUNT 16 +#else // PDF_ENABLE_XFA +#define FPDF_FORMFIELD_COUNT 8 +#endif // PDF_ENABLE_XFA + +#ifdef PDF_ENABLE_XFA +#define IS_XFA_FORMFIELD(type) \ + (((type) == FPDF_FORMFIELD_XFA) || \ + ((type) == FPDF_FORMFIELD_XFA_CHECKBOX) || \ + ((type) == FPDF_FORMFIELD_XFA_COMBOBOX) || \ + ((type) == FPDF_FORMFIELD_XFA_IMAGEFIELD) || \ + ((type) == FPDF_FORMFIELD_XFA_LISTBOX) || \ + ((type) == FPDF_FORMFIELD_XFA_PUSHBUTTON) || \ + ((type) == FPDF_FORMFIELD_XFA_SIGNATURE) || \ + ((type) == FPDF_FORMFIELD_XFA_TEXTFIELD)) #endif // PDF_ENABLE_XFA /** @@ -1393,19 +1617,11 @@ DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle); * Return the type of the form field; -1 indicates no field. * See field types above. **/ -DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, - FPDF_PAGE page, - double page_x, - double page_y); - -/** - * Function: FPDPage_HasFormFieldAtPoint - * DEPRECATED. Please use FPDFPage_HasFormFieldAtPoint. - **/ -DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, - FPDF_PAGE page, - double page_x, - double page_y); +FPDF_EXPORT int FPDF_CALLCONV +FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); /** * Function: FPDFPage_FormFieldZOrderAtPoint @@ -1420,10 +1636,11 @@ DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, * Return the z-order of the form field; -1 indicates no field. * Higher numbers are closer to the front. **/ -DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, - FPDF_PAGE page, - double page_x, - double page_y); +FPDF_EXPORT int FPDF_CALLCONV +FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); /** * Function: FPDF_SetFormFieldHighlightColor @@ -1441,15 +1658,16 @@ DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, * 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 FPDF_FORMFIELD_UNKNOWN, 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. + * if necessary. **/ -DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, - int fieldType, - unsigned long color); +FPDF_EXPORT void FPDF_CALLCONV +FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, + int fieldType, + unsigned long color); /** * Function: FPDF_SetFormFieldHighlightAlpha @@ -1465,8 +1683,8 @@ DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, * Return Value: * NONE. **/ -DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, - unsigned char alpha); +FPDF_EXPORT void FPDF_CALLCONV +FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha); /** * Function: FPDF_RemoveFormFieldHighlight @@ -1480,7 +1698,8 @@ DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, * Please refresh the client window to remove the highlight immediately *if necessary. **/ -DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle); +FPDF_EXPORT void FPDF_CALLCONV +FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle); /** * Function: FPDF_FFLDraw @@ -1520,45 +1739,93 @@ DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle); *call this function after rendering functions, such as FPDF_RenderPageBitmap or *FPDF_RenderPageBitmap_Start, 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); +FPDF_EXPORT void FPDF_CALLCONV 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); #ifdef _SKIA_SUPPORT_ -DLLEXPORT void STDCALL FPDF_FFLRecord(FPDF_FORMHANDLE hHandle, - FPDF_RECORDER recorder, - FPDF_PAGE page, - int start_x, - int start_y, - int size_x, - int size_y, - int rotate, - int flags); +FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLRecord(FPDF_FORMHANDLE hHandle, + FPDF_RECORDER recorder, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); #endif -#ifdef PDF_ENABLE_XFA /** - * Function: FPDF_HasXFAField - * This method is designed to check whether a pdf document - *has XFA fields. + * Experimental API + * Function: FPDF_GetFormType + * Returns the type of form contained in the PDF document. * Parameters: - * document - Handle to document. - *Returned by FPDF_LoadDocument function. - * docType - Document type defined as - *DOCTYPE_xxx. + * document - Handle to document. * Return Value: - * TRUE indicates that the input document has XFA fields, - *otherwise FALSE. + * Integer value representing one of the FORMTYPE_ values. + * Comments: + * If |document| is NULL, then the return value is FORMTYPE_NONE. **/ -DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, - int* docType); +FPDF_EXPORT int FPDF_CALLCONV FPDF_GetFormType(FPDF_DOCUMENT document); +/** + * Experimental API + * Function: FORM_SetIndexSelected + * Selects/deselects the value at the given |index| of the focused + * annotation. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + * index - 0-based index of value to be set as + * selected/unselected + * selected - true to select, false to deselect + * Return Value: + * TRUE if the operation succeeded. + * FALSE if the operation failed or widget is not a supported type. + * Comments: + * Intended for use with listbox/combobox widget types. Comboboxes + * have at most a single value selected at a time which cannot be + * deselected. Deselect on a combobox is a no-op that returns false. + * Default implementation is a no-op that will return false for + * other types. + * Not currently supported for XFA forms - will return false. + **/ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FORM_SetIndexSelected(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int index, + FPDF_BOOL selected); + +/** + * Experimental API + * Function: FORM_IsIndexSelected + * Returns whether or not the value at |index| of the focused + * annotation is currently selected. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + * index - 0-based Index of value to check + * Return Value: + * TRUE if value at |index| is currently selected. + * FALSE if value at |index| is not selected or widget is not a + * supported type. + * Comments: + * Intended for use with listbox/combobox widget types. Default + * implementation is a no-op that will return false for other types. + * Not currently supported for XFA forms - will return false. + **/ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FORM_IsIndexSelected(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int index); + +#ifdef PDF_ENABLE_XFA /** * Function: FPDF_LoadXFA * If the document consists of XFA fields, there should call this @@ -1569,192 +1836,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, * Return Value: * TRUE indicates success,otherwise FALSE. **/ -DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document); - -/** - * Function: FPDF_Widget_Undo - * This method will implement the undo feature for the specified xfa - *field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * Return Value: - * None. - **/ -DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget); -/** - * Function: FPDF_Widget_Redo - * This method will implement the redo feature for the specified xfa - *field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * Return Value: - * None. - **/ -DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget); -/** - * Function: FPDF_Widget_SelectAll - * This method will implement the select all feature for the specified - *xfa field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * Return Value: - * None. - **/ -DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget); -/** - * Function: FPDF_Widget_Copy - * This method will implement the copy feature for the specified xfa - *field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * wsText - Pointer to data buffer to receive the copied - *data, in UTF-16LE format. - * size - The data buffer size. - * Return Value: - * None. - **/ -DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - FPDF_WIDESTRING wsText, - FPDF_DWORD* size); -/** - * Function: FPDF_Widget_Cut - * This method will implement the cut feature for the specified xfa - *field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * wsText - Pointer to data buffer to receive the cut - *data,in UTF-16LE format. - * size - The data buffer size,not the byte number. - * Return Value: - * None. - **/ -DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - FPDF_WIDESTRING wsText, - FPDF_DWORD* size); -/** - * Function: FPDF_Widget_Paste - * This method will implement the paste feature for the specified xfa - *field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * wsText - The paste text buffer, in UTF-16LE format. - * size - The data buffer size,not the byte number. - * Return Value: - * None. - **/ -DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - FPDF_WIDESTRING wsText, - FPDF_DWORD size); -/** - * Function: FPDF_Widget_ReplaceSpellCheckWord - * This method will implement the spell check feature for the specified - *xfa field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * x - The x value of the specified point. - * y - The y value of the specified point. - * bsText - The text buffer needed to be speck check, in - *UTF-16LE format. - * Return Value: - * None. - **/ -DLLEXPORT void STDCALL -FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - float x, - float y, - FPDF_BYTESTRING bsText); -/** - * Function: FPDF_Widget_GetSpellCheckWords - * This method will implement the spell check feature for the specified - *xfa field. - * Parameters: - * document - Handle to document. Returned by - *FPDF_LoadDocument function. - * hWidget - Handle to the xfa field. - * x - The x value of the specified point. - * y - The y value of the specified point. - * stringHandle - Pointer to FPDF_STRINGHANDLE to receive the - *speck check text buffer, in UTF-16LE format. - * Return Value: - * None. - **/ -DLLEXPORT void STDCALL -FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, - FPDF_WIDGET hWidget, - float x, - float y, - FPDF_STRINGHANDLE* stringHandle); -/** - * Function: FPDF_StringHandleCounts - * This method will get the count of the text buffer. - * Parameters: - * stringHandle - Pointer to FPDF_STRINGHANDLE. - * Return Value: - * None. - **/ -DLLEXPORT int STDCALL FPDF_StringHandleCounts(FPDF_STRINGHANDLE stringHandle); -/** - * Function: FPDF_StringHandleGetStringByIndex - * This method will get the specified index of the text buffer. - * Parameters: - * stringHandle - Pointer to FPDF_STRINGHANDLE. - * index - The specified index of text buffer. - * bsText - Pointer to data buffer to receive the text - *buffer, in UTF-16LE format. - * size - The byte size of data buffer. - * Return Value: - * TRUE indicates success, otherwise FALSE. - **/ -DLLEXPORT FPDF_BOOL STDCALL -FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE stringHandle, - int index, - FPDF_BYTESTRING bsText, - FPDF_DWORD* size); -/** - * Function: FPDF_StringHandleRelease - * This method will release the FPDF_STRINGHANDLE. - * Parameters: - * stringHandle - Pointer to FPDF_STRINGHANDLE. - * Return Value: - * None. - **/ -DLLEXPORT void STDCALL FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle); -/** - * Function: FPDF_StringHandleAddString - * This method will add the specified text buffer. - * Parameters: - * stringHandle - Pointer to FPDF_STRINGHANDLE. - * bsText - Pointer to data buffer of the text buffer, in - *UTF-16LE format. - * size - The byte size of data buffer. - * Return Value: - * TRUE indicates success, otherwise FALSE. - **/ -DLLEXPORT FPDF_BOOL STDCALL -FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, - FPDF_BYTESTRING bsText, - FPDF_DWORD size); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_LoadXFA(FPDF_DOCUMENT document); #endif // PDF_ENABLE_XFA #ifdef __cplusplus diff --git a/dependencies/pdfium/win/public/fpdf_ppo.h b/dependencies/pdfium/win/public/fpdf_ppo.h index d9c83002..85112696 100644 --- a/dependencies/pdfium/win/public/fpdf_ppo.h +++ b/dependencies/pdfium/win/public/fpdf_ppo.h @@ -23,10 +23,34 @@ extern "C" { // index - The page index to insert at. // // Returns TRUE on success. -DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc, - FPDF_DOCUMENT src_doc, - FPDF_BYTESTRING pagerange, - int index); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_ImportPages(FPDF_DOCUMENT dest_doc, + FPDF_DOCUMENT src_doc, + FPDF_BYTESTRING pagerange, + int index); + +// Experimental API. +// Create a new document from |src_doc|. The pages of |src_doc| will be +// combined to provide |num_pages_on_x_axis x num_pages_on_y_axis| pages per +// |output_doc| page. +// +// src_doc - The document to be imported. +// output_width - The output page width in PDF "user space" units. +// output_height - The output page height in PDF "user space" units. +// num_pages_on_x_axis - The number of pages on X Axis. +// num_pages_on_y_axis - The number of pages on Y Axis. +// +// Return value: +// A handle to the created document, or NULL on failure. +// +// Comments: +// number of pages per page = num_pages_on_x_axis * num_pages_on_y_axis +// +FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV +FPDF_ImportNPagesToOne(FPDF_DOCUMENT src_doc, + float output_width, + float output_height, + unsigned int num_pages_on_x_axis, + unsigned int num_pages_on_y_axis); // Copy the viewer preferences from |src_doc| into |dest_doc|. // @@ -34,8 +58,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc, // src_doc - Document to read the viewer preferences from. // // Returns TRUE on success. -DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, - FPDF_DOCUMENT src_doc); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc); #ifdef __cplusplus } // extern "C" diff --git a/dependencies/pdfium/win/public/fpdf_progressive.h b/dependencies/pdfium/win/public/fpdf_progressive.h index 0c3d5013..1d7495aa 100644 --- a/dependencies/pdfium/win/public/fpdf_progressive.h +++ b/dependencies/pdfium/win/public/fpdf_progressive.h @@ -11,8 +11,8 @@ #include "fpdfview.h" // Flags for progressive process status. -#define FPDF_RENDER_READER 0 -#define FPDF_RENDER_TOBECOUNTINUED 1 +#define FPDF_RENDER_READY 0 +#define FPDF_RENDER_TOBECONTINUED 1 #define FPDF_RENDER_DONE 2 #define FPDF_RENDER_FAILED 3 @@ -77,15 +77,15 @@ typedef struct _IFSDK_PAUSE { // Rendering Status. See flags for progressive process status for the // details. // -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); +FPDF_EXPORT int FPDF_CALLCONV 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. @@ -99,8 +99,8 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, // Return value: // The rendering status. See flags for progressive process status for // the details. -DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page, - IFSDK_PAUSE* pause); +FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPage_Continue(FPDF_PAGE page, + IFSDK_PAUSE* pause); // Function: FPDF_RenderPage_Close // Release the resource allocate during page rendering. Need to be @@ -111,7 +111,7 @@ DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page, // function. // Return value: // NULL -DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page); +FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage_Close(FPDF_PAGE page); #ifdef __cplusplus } diff --git a/dependencies/pdfium/win/public/fpdf_save.h b/dependencies/pdfium/win/public/fpdf_save.h index c34e2bc6..6ffca52e 100644 --- a/dependencies/pdfium/win/public/fpdf_save.h +++ b/dependencies/pdfium/win/public/fpdf_save.h @@ -59,9 +59,9 @@ typedef struct FPDF_FILEWRITE_ { // Return value: // TRUE for succeed, FALSE for failed. // -DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, - FPDF_FILEWRITE* pFileWrite, - FPDF_DWORD flags); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 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 @@ -75,10 +75,11 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, // 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); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDF_SaveWithVersion(FPDF_DOCUMENT document, + FPDF_FILEWRITE* pFileWrite, + FPDF_DWORD flags, + int fileVersion); #ifdef __cplusplus } diff --git a/dependencies/pdfium/win/public/fpdf_searchex.h b/dependencies/pdfium/win/public/fpdf_searchex.h index 7c1b3184..4b67786f 100644 --- a/dependencies/pdfium/win/public/fpdf_searchex.h +++ b/dependencies/pdfium/win/public/fpdf_searchex.h @@ -17,12 +17,21 @@ extern "C" { // Get the character index in |text_page| internal character list. // // text_page - a text page information structure. -// nTextIndex - index of the text returned from |FPDFText_GetText|. +// nTextIndex - index of the text returned from FPDFText_GetText(). // // Returns the index of the character in internal character list. -1 for error. -DLLEXPORT int STDCALL +FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex); +// Get the text index in |text_page| internal character list. +// +// text_page - a text page information structure. +// nCharIndex - index of the character in internal character list. +// +// Returns the index of the text returned from FPDFText_GetText(). -1 for error. +FPDF_EXPORT int FPDF_CALLCONV +FPDFText_GetTextIndexFromCharIndex(FPDF_TEXTPAGE text_page, int nCharIndex); + #ifdef __cplusplus } // extern "C" #endif // __cplusplus diff --git a/dependencies/pdfium/win/public/fpdf_structtree.h b/dependencies/pdfium/win/public/fpdf_structtree.h index 3d4da402..2e86ae65 100644 --- a/dependencies/pdfium/win/public/fpdf_structtree.h +++ b/dependencies/pdfium/win/public/fpdf_structtree.h @@ -21,7 +21,8 @@ extern "C" { // function. // Return value: // A handle to the structure tree or NULL on error. -DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page); +FPDF_EXPORT FPDF_STRUCTTREE FPDF_CALLCONV +FPDF_StructTree_GetForPage(FPDF_PAGE page); // Function: FPDF_StructTree_Close // Release the resource allocate by FPDF_StructTree_GetForPage. @@ -30,7 +31,8 @@ DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page); // FPDF_StructTree_LoadPage function. // Return value: // NULL -DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree); +FPDF_EXPORT void FPDF_CALLCONV +FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree); // Function: FPDF_StructTree_CountChildren // Count the number of children for the structure tree. @@ -39,7 +41,7 @@ DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree); // FPDF_StructTree_LoadPage function. // Return value: // The number of children, or -1 on error. -DLLEXPORT int STDCALL +FPDF_EXPORT int FPDF_CALLCONV FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree); // Function: FPDF_StructTree_GetChildAtIndex @@ -50,7 +52,7 @@ FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree); // index - The index for the child, 0-based. // Return value: // The child at the n-th index or NULL on error. -DLLEXPORT FPDF_STRUCTELEMENT STDCALL +FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index); // Function: FPDF_StructElement_GetAltText @@ -68,18 +70,68 @@ FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index); // encoding. The string is terminated by a UTF16 NUL character. If // |buflen| is less than the required length, or |buffer| is NULL, // |buffer| will not be modified. -DLLEXPORT unsigned long STDCALL +FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element, void* buffer, unsigned long buflen); +// Function: FPDF_StructElement_GetMarkedContentID +// Get the marked content ID for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// Return value: +// The marked content ID of the element. If no ID exists, returns +// -1. +FPDF_EXPORT int FPDF_CALLCONV +FPDF_StructElement_GetMarkedContentID(FPDF_STRUCTELEMENT struct_element); + +// Function: FPDF_StructElement_GetType +// Get the type (/S) for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// buffer - A buffer for output. May be NULL. +// buflen - The length of the buffer, in bytes. May be 0. +// Return value: +// The number of bytes in the type, including the terminating NUL +// character. The number of bytes is returned regardless of the +// |buffer| and |buflen| parameters. +// Comments: +// Regardless of the platform, the |buffer| is always in UTF-16LE +// encoding. The string is terminated by a UTF16 NUL character. If +// |buflen| is less than the required length, or |buffer| is NULL, +// |buffer| will not be modified. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element, + void* buffer, + unsigned long buflen); + +// Function: FPDF_StructElement_GetTitle +// Get the title (/T) for a given element. +// Parameters: +// struct_element - Handle to the struct element. +// buffer - A buffer for output. May be NULL. +// buflen - The length of the buffer, in bytes. May be 0. +// Return value: +// The number of bytes in the title, including the terminating NUL +// character. The number of bytes is returned regardless of the +// |buffer| and |buflen| parameters. +// Comments: +// Regardless of the platform, the |buffer| is always in UTF-16LE +// encoding. The string is terminated by a UTF16 NUL character. If +// |buflen| is less than the required length, or |buffer| is NULL, +// |buffer| will not be modified. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDF_StructElement_GetTitle(FPDF_STRUCTELEMENT struct_element, + void* buffer, + unsigned long buflen); + // Function: FPDF_StructElement_CountChildren // Count the number of children for the structure element. // Parameters: // struct_element - Handle to the struct element. // Return value: // The number of children, or -1 on error. -DLLEXPORT int STDCALL +FPDF_EXPORT int FPDF_CALLCONV FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element); // Function: FPDF_StructElement_GetChildAtIndex @@ -92,12 +144,12 @@ FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element); // Comments: // If the child exists but is not an element, then this function will // return NULL. This will also return NULL for out of bounds indices. -DLLEXPORT FPDF_STRUCTELEMENT STDCALL +FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element, int index); #ifdef __cplusplus -} +} // extern "C" #endif #endif // PUBLIC_FPDF_STRUCTTREE_H_ diff --git a/dependencies/pdfium/win/public/fpdf_sysfontinfo.h b/dependencies/pdfium/win/public/fpdf_sysfontinfo.h index a0edffff..49302c89 100644 --- a/dependencies/pdfium/win/public/fpdf_sysfontinfo.h +++ b/dependencies/pdfium/win/public/fpdf_sysfontinfo.h @@ -20,7 +20,7 @@ #define FXFONT_CHINESEBIG5_CHARSET 136 /* Font pitch and family flags */ -#define FXFONT_FF_FIXEDPITCH 1 +#define FXFONT_FF_FIXEDPITCH (1 << 0) #define FXFONT_FF_ROMAN (1 << 4) #define FXFONT_FF_SCRIPT (4 << 4) @@ -106,10 +106,7 @@ typedef struct _FPDF_SYSFONTINFO { *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. + * bExact - Obsolete: this parameter is now ignored. * Return Value: * An opaque pointer for font handle, or NULL if system mapping is *not supported. @@ -244,7 +241,7 @@ typedef struct FPDF_CharsetFontMap_ { * Return Value: * Pointer to the Charset Font Map. **/ -DLLEXPORT const FPDF_CharsetFontMap* STDCALL FPDF_GetDefaultTTFMap(); +FPDF_EXPORT const FPDF_CharsetFontMap* FPDF_CALLCONV FPDF_GetDefaultTTFMap(); /** * Function: FPDF_AddInstalledFont @@ -259,9 +256,9 @@ DLLEXPORT const FPDF_CharsetFontMap* STDCALL FPDF_GetDefaultTTFMap(); * Return Value: * None. **/ -DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, - const char* face, - int charset); +FPDF_EXPORT void FPDF_CALLCONV FPDF_AddInstalledFont(void* mapper, + const char* face, + int charset); /** * Function: FPDF_SetSystemFontInfo @@ -275,7 +272,8 @@ DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, * Return Value: * None **/ -DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); +FPDF_EXPORT void FPDF_CALLCONV +FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); /** * Function: FPDF_GetDefaultSystemFontInfo @@ -294,7 +292,7 @@ DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); * Application should call FPDF_FreeDefaultSystemFontInfo to free the *returned pointer. **/ -DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo(); +FPDF_EXPORT FPDF_SYSFONTINFO* FPDF_CALLCONV FPDF_GetDefaultSystemFontInfo(); /** * Function: FPDF_FreeDefaultSystemFontInfo @@ -307,7 +305,8 @@ DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo(); * Return Value: * None **/ -DLLEXPORT void FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); +FPDF_EXPORT void FPDF_CALLCONV +FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); #ifdef __cplusplus } diff --git a/dependencies/pdfium/win/public/fpdf_text.h b/dependencies/pdfium/win/public/fpdf_text.h index 5c241527..008c2369 100644 --- a/dependencies/pdfium/win/public/fpdf_text.h +++ b/dependencies/pdfium/win/public/fpdf_text.h @@ -27,7 +27,7 @@ extern "C" { // Application must call FPDFText_ClosePage to release the text page // information. // -DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page); +FPDF_EXPORT FPDF_TEXTPAGE FPDF_CALLCONV FPDFText_LoadPage(FPDF_PAGE page); // Function: FPDFText_ClosePage // Release all resources allocated for a text page information @@ -38,7 +38,7 @@ DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page); // Return Value: // None. // -DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page); +FPDF_EXPORT void FPDF_CALLCONV FPDFText_ClosePage(FPDF_TEXTPAGE text_page); // Function: FPDFText_CountChars // Get number of characters in a page. @@ -56,7 +56,7 @@ DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page); // first character in the page // has an index value of zero. // -DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page); +FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountChars(FPDF_TEXTPAGE text_page); // Function: FPDFText_GetUnicode // Get Unicode of a character in a page. @@ -70,8 +70,8 @@ DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page); // convert to Unicode, // the return value will be zero. // -DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, - int index); +FPDF_EXPORT unsigned int FPDF_CALLCONV +FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index); // Function: FPDFText_GetFontSize // Get the font size of a particular character. @@ -84,8 +84,33 @@ DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, // 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); +FPDF_EXPORT double FPDF_CALLCONV FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, + int index); + +// Experimental API. +// Function: FPDFText_GetFontInfo +// Get the font name and flags of a particular character. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// index - Zero-based index of the character. +// buffer - A buffer receiving the font name. +// buflen - The length of |buffer| in bytes. +// flags - Optional pointer to an int receiving the font flags. +// These flags should be interpreted per PDF spec 1.7 Section 5.7.1 +// Font Descriptor Flags. +// Return value: +// On success, return the length of the font name, including the +// trailing NUL character, in bytes. If this length is less than or +// equal to |length|, |buffer| is set to the font name, |flags| is +// set to the font flags. |buffer| is in UTF-8 encoding. Return 0 on +// failure. +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDFText_GetFontInfo(FPDF_TEXTPAGE text_page, + int index, + void* buffer, + unsigned long buflen, + int* flags); // Function: FPDFText_GetCharBox // Get bounding box of a particular character. @@ -102,16 +127,39 @@ DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, // top - Pointer to a double number receiving top position of // the character box. // Return Value: -// None. +// On success, return TRUE and fill in |left|, |right|, |bottom|, and +// |top|. If |text_page| is invalid, or if |index| is out of bounds, +// then return FALSE, and the out parameters remain unmodified. // 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); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, + int index, + double* left, + double* right, + double* bottom, + double* top); + +// Function: FPDFText_GetCharOrigin +// Get origin of a particular character. +// Parameters: +// text_page - Handle to a text page information structure. +// Returned by FPDFText_LoadPage function. +// index - Zero-based index of the character. +// x - Pointer to a double number receiving x coordinate of +// the character origin. +// y - Pointer to a double number receiving y coordinate of +// the character origin. +// Return Value: +// Whether the call succeeded. If false, x and y are unchanged. +// Comments: +// All positions are measured in PDF "user space". +// +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFText_GetCharOrigin(FPDF_TEXTPAGE text_page, + int index, + double* x, + double* y); // Function: FPDFText_GetCharIndexAtPos // Get the index of a character at or nearby a certain position on the @@ -131,11 +179,12 @@ DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, // be -1. // If an error occurs, -3 will be returned. // -DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, - double x, - double y, - double xTolerance, - double yTolerance); +FPDF_EXPORT int FPDF_CALLCONV +FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, + double x, + double y, + double xTolerance, + double yTolerance); // Function: FPDFText_GetText // Extract unicode text string from the page. @@ -154,10 +203,10 @@ DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, // 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); +FPDF_EXPORT int FPDF_CALLCONV 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. @@ -177,9 +226,9 @@ DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, // 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); +FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountRects(FPDF_TEXTPAGE text_page, + int start_index, + int count); // Function: FPDFText_GetRect // Get a rectangular area from the result generated by @@ -197,14 +246,18 @@ DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, // bottom - Pointer to a double value receiving the rectangle // bottom boundary. // Return Value: -// None. +// On success, return TRUE and fill in |left|, |top|, |right|, and +// |bottom|. If |text_page| is invalid then return FALSE, and the out +// parameters remain unmodified. If |text_page| is valid but +// |rect_index| is out of bounds, then return FALSE and set the out +// parameters to 0. // -DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, - int rect_index, - double* left, - double* top, - double* right, - double* bottom); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 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. @@ -232,19 +285,22 @@ DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, // 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); +FPDF_EXPORT int FPDF_CALLCONV 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. +// +// If not set, it will not match case by default. +#define FPDF_MATCHCASE 0x00000001 +// If not set, it will not match the whole word by default. +#define FPDF_MATCHWHOLEWORD 0x00000002 +// If not set, it will skip past the current match to look for the next match. +#define FPDF_CONSECUTIVE 0x00000004 // Function: FPDFText_FindStart // Start a search. @@ -258,10 +314,11 @@ DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, // 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); +FPDF_EXPORT FPDF_SCHHANDLE FPDF_CALLCONV +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. @@ -271,7 +328,7 @@ DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, // Return Value: // Whether a match is found. // -DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_FindNext(FPDF_SCHHANDLE handle); // Function: FPDFText_FindPrev // Search in the direction from page end to start. @@ -281,7 +338,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle); // Return Value: // Whether a match is found. // -DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_FindPrev(FPDF_SCHHANDLE handle); // Function: FPDFText_GetSchResultIndex // Get the starting character index of the search result. @@ -291,7 +348,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle); // Return Value: // Index for the starting character. // -DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle); +FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle); // Function: FPDFText_GetSchCount // Get the number of matched characters in the search result. @@ -301,7 +358,7 @@ DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle); // Return Value: // Number of matched characters. // -DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle); +FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetSchCount(FPDF_SCHHANDLE handle); // Function: FPDFText_FindClose // Release a search context. @@ -311,7 +368,7 @@ DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle); // Return Value: // None. // -DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle); +FPDF_EXPORT void FPDF_CALLCONV FPDFText_FindClose(FPDF_SCHHANDLE handle); // Function: FPDFLink_LoadWebLinks // Prepare information about weblinks in a page. @@ -336,7 +393,8 @@ DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle); // // FPDFLink_CloseWebLinks must be called to release resources. // -DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page); +FPDF_EXPORT FPDF_PAGELINK FPDF_CALLCONV +FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page); // Function: FPDFLink_CountWebLinks // Count number of detected web links. @@ -345,7 +403,7 @@ DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page); // Return Value: // Number of detected web links. // -DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page); +FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountWebLinks(FPDF_PAGELINK link_page); // Function: FPDFLink_GetURL // Fetch the URL information for a detected web link. @@ -366,10 +424,10 @@ DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page); // If |link_index| does not correspond to a valid link, then the result // is an empty string. // -DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, - int link_index, - unsigned short* buffer, - int buflen); +FPDF_EXPORT int FPDF_CALLCONV 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. @@ -380,8 +438,8 @@ DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, // Number of rectangular areas for the link. If |link_index| does // not correspond to a valid link, then 0 is returned. // -DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, - int link_index); +FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountRects(FPDF_PAGELINK link_page, + int link_index); // Function: FPDFLink_GetRect // Fetch the boundaries of a rectangle for a link. @@ -398,16 +456,18 @@ DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, // bottom - Pointer to a double value receiving the rectangle // bottom boundary. // Return Value: -// None. If |link_index| does not correspond to a valid link, then -// |left|, |top|, |right|, and |bottom| remain unmodified. +// On success, return TRUE and fill in |left|, |top|, |right|, and +// |bottom|. If |link_page| is invalid or if |link_index| does not +// correspond to a valid link, then return FALSE, and the out +// parameters remain unmodified. // -DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, - int link_index, - int rect_index, - double* left, - double* top, - double* right, - double* bottom); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 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. @@ -416,7 +476,7 @@ DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, // Return Value: // None. // -DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page); +FPDF_EXPORT void FPDF_CALLCONV FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page); #ifdef __cplusplus } diff --git a/dependencies/pdfium/win/public/fpdf_transformpage.h b/dependencies/pdfium/win/public/fpdf_transformpage.h index 66271fcd..a2eb6b0e 100644 --- a/dependencies/pdfium/win/public/fpdf_transformpage.h +++ b/dependencies/pdfium/win/public/fpdf_transformpage.h @@ -14,102 +14,204 @@ extern "C" { #endif -typedef void* FPDF_PAGEARCSAVER; -typedef void* FPDF_PAGEARCLOADER; +/** + * Set "MediaBox" entry to the page dictionary. + * + * page - Handle to a page. + * left - The left of the rectangle. + * bottom - The bottom of the rectangle. + * right - The right of the rectangle. + * top - The top of the rectangle. + */ +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetMediaBox(FPDF_PAGE page, + float left, + float bottom, + float right, + float top); /** -* Set "MediaBox" entry to the page dictionary. -* @param[in] page - Handle to a page. -* @param[in] left - The left of the rectangle. -* @param[in] bottom - The bottom of the rectangle. -* @param[in] right - The right of the rectangle. -* @param[in] top - The top of the rectangle. -* @retval None. -*/ -DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, - float left, - float bottom, - float right, - float top); + * Set "CropBox" entry to the page dictionary. + * + * page - Handle to a page. + * left - The left of the rectangle. + * bottom - The bottom of the rectangle. + * right - The right of the rectangle. + * top - The top of the rectangle. + */ +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetCropBox(FPDF_PAGE page, + float left, + float bottom, + float right, + float top); /** -* Set "CropBox" entry to the page dictionary. -* @param[in] page - Handle to a page. -* @param[in] left - The left of the rectangle. -* @param[in] bottom - The bottom of the rectangle. -* @param[in] right - The right of the rectangle. -* @param[in] top - The top of the rectangle. -* @retval None. -*/ -DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, - float left, - float bottom, - float right, - float top); - -/** Get "MediaBox" entry from the page dictionary. -* @param[in] page - Handle to a page. -* @param[in] left - Pointer to a double value receiving the left of the -* rectangle. -* @param[in] bottom - Pointer to a double value receiving the bottom of the -* rectangle. -* @param[in] right - Pointer to a double value receiving the right of the -* rectangle. -* @param[in] top - Pointer to a double value receiving the top of the -* rectangle. -* @retval True if success,else fail. -*/ -DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, - float* left, - float* bottom, - float* right, - float* top); - -/** Get "CropBox" entry from the page dictionary. -* @param[in] page - Handle to a page. -* @param[in] left - Pointer to a double value receiving the left of the -* rectangle. -* @param[in] bottom - Pointer to a double value receiving the bottom of the -* rectangle. -* @param[in] right - Pointer to a double value receiving the right of the -* rectangle. -* @param[in] top - Pointer to a double value receiving the top of the -* rectangle. -* @retval True if success,else fail. -*/ -DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, - float* left, - float* bottom, - float* right, - float* top); + * Set "BleedBox" entry to the page dictionary. + * + * page - Handle to a page. + * left - The left of the rectangle. + * bottom - The bottom of the rectangle. + * right - The right of the rectangle. + * top - The top of the rectangle. + */ +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetBleedBox(FPDF_PAGE page, + float left, + float bottom, + float right, + float top); /** -* Transform the whole page with a specified matrix, then clip the page content -* region. -* -* @param[in] page - A page handle. -* @param[in] matrix - The transform matrix. -* @param[in] clipRect - A rectangle page area to be clipped. -* @Note. This function will transform the whole page, and would take effect to -* all the objects in the page. -*/ -DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, - FS_MATRIX* matrix, - FS_RECTF* clipRect); + * Set "TrimBox" entry to the page dictionary. + * + * page - Handle to a page. + * left - The left of the rectangle. + * bottom - The bottom of the rectangle. + * right - The right of the rectangle. + * top - The top of the rectangle. + */ +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetTrimBox(FPDF_PAGE page, + float left, + float bottom, + float right, + float top); /** -* Transform (scale, rotate, shear, move) the clip path of page object. -* @param[in] page_object - Handle to a page object. Returned by -* FPDFPageObj_NewImageObj. -* @param[in] a - The coefficient "a" of the matrix. -* @param[in] b - The coefficient "b" of the matrix. -* @param[in] c - The coefficient "c" of the matrix. -* @param[in] d - The coefficient "d" of the matrix. -* @param[in] e - The coefficient "e" of the matrix. -* @param[in] f - The coefficient "f" of the matrix. -* @retval None. -*/ -DLLEXPORT void STDCALL + * Set "ArtBox" entry to the page dictionary. + * + * page - Handle to a page. + * left - The left of the rectangle. + * bottom - The bottom of the rectangle. + * right - The right of the rectangle. + * top - The top of the rectangle. + */ +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetArtBox(FPDF_PAGE page, + float left, + float bottom, + float right, + float top); + +/** + * Get "MediaBox" entry from the page dictionary. + * + * page - Handle to a page. + * left - Pointer to a float value receiving the left of the rectangle. + * bottom - Pointer to a float value receiving the bottom of the rectangle. + * right - Pointer to a float value receiving the right of the rectangle. + * top - Pointer to a float value receiving the top of the rectangle. + * + * On success, return true and write to the out parameters. Otherwise return + * false and leave the out parameters unmodified. + */ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetMediaBox(FPDF_PAGE page, + float* left, + float* bottom, + float* right, + float* top); + +/** + * Get "CropBox" entry from the page dictionary. + * + * page - Handle to a page. + * left - Pointer to a float value receiving the left of the rectangle. + * bottom - Pointer to a float value receiving the bottom of the rectangle. + * right - Pointer to a float value receiving the right of the rectangle. + * top - Pointer to a float value receiving the top of the rectangle. + * + * On success, return true and write to the out parameters. Otherwise return + * false and leave the out parameters unmodified. + */ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetCropBox(FPDF_PAGE page, + float* left, + float* bottom, + float* right, + float* top); + +/** + * Get "BleedBox" entry from the page dictionary. + * + * page - Handle to a page. + * left - Pointer to a float value receiving the left of the rectangle. + * bottom - Pointer to a float value receiving the bottom of the rectangle. + * right - Pointer to a float value receiving the right of the rectangle. + * top - Pointer to a float value receiving the top of the rectangle. + * + * On success, return true and write to the out parameters. Otherwise return + * false and leave the out parameters unmodified. + */ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetBleedBox(FPDF_PAGE page, + float* left, + float* bottom, + float* right, + float* top); + +/** + * Get "TrimBox" entry from the page dictionary. + * + * page - Handle to a page. + * left - Pointer to a float value receiving the left of the rectangle. + * bottom - Pointer to a float value receiving the bottom of the rectangle. + * right - Pointer to a float value receiving the right of the rectangle. + * top - Pointer to a float value receiving the top of the rectangle. + * + * On success, return true and write to the out parameters. Otherwise return + * false and leave the out parameters unmodified. + */ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetTrimBox(FPDF_PAGE page, + float* left, + float* bottom, + float* right, + float* top); + +/** + * Get "ArtBox" entry from the page dictionary. + * + * page - Handle to a page. + * left - Pointer to a float value receiving the left of the rectangle. + * bottom - Pointer to a float value receiving the bottom of the rectangle. + * right - Pointer to a float value receiving the right of the rectangle. + * top - Pointer to a float value receiving the top of the rectangle. + * + * On success, return true and write to the out parameters. Otherwise return + * false and leave the out parameters unmodified. + */ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetArtBox(FPDF_PAGE page, + float* left, + float* bottom, + float* right, + float* top); + +/** + * Apply transforms to |page|. + * + * If |matrix| is provided it will be applied to transform the page. + * If |clipRect| is provided it will be used to clip the resulting page. + * If neither |matrix| or |clipRect| are provided this method returns |false|. + * Returns |true| if transforms are applied. + * + * This function will transform the whole page, and would take effect to all the + * objects in the page. + * + * page - Page handle. + * matrix - Transform matrix. + * clipRect - Clipping rectangle. + */ +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDFPage_TransFormWithClip(FPDF_PAGE page, + const FS_MATRIX* matrix, + const FS_RECTF* clipRect); + +/** + * Transform (scale, rotate, shear, move) the clip path of page object. + * page_object - Handle to a page object. Returned by + * FPDFPageObj_NewImageObj(). + * + * a - The coefficient "a" of the matrix. + * b - The coefficient "b" of the matrix. + * c - The coefficient "c" of the matrix. + * d - The coefficient "d" of the matrix. + * e - The coefficient "e" of the matrix. + * f - The coefficient "f" of the matrix. + */ +FPDF_EXPORT void FPDF_CALLCONV FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, double a, double b, @@ -119,40 +221,40 @@ FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, double f); /** -* Create a new clip path, with a rectangle inserted. -* -* @param[in] left - The left of the clip box. -* @param[in] bottom - The bottom of the clip box. -* @param[in] right - The right of the clip box. -* @param[in] top - The top of the clip box. -* @retval a handle to the clip path. -*/ -DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, - float bottom, - float right, - float top); + * Create a new clip path, with a rectangle inserted. + * + * Caller takes ownership of the returned FPDF_CLIPPATH. It should be freed with + * FPDF_DestroyClipPath(). + * + * left - The left of the clip box. + * bottom - The bottom of the clip box. + * right - The right of the clip box. + * top - The top of the clip box. + */ +FPDF_EXPORT FPDF_CLIPPATH FPDF_CALLCONV FPDF_CreateClipPath(float left, + float bottom, + float right, + float top); /** -* Destroy the clip path. -* -* @param[in] clipPath - A handle to the clip path. -* Destroy the clip path. -* @retval None. -*/ -DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath); + * Destroy the clip path. + * + * clipPath - A handle to the clip path. It will be invalid after this call. + */ +FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath); /** -* Clip the page content, the page content that outside the clipping region -* become invisible. -* -* @param[in] page - A page handle. -* @param[in] clipPath - A handle to the clip path. -* @Note. A clip path will be inserted before the page content stream or content -* array. In this way, the page content will be clipped -* by this clip path. -*/ -DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, - FPDF_CLIPPATH clipPath); + * Clip the page content, the page content that outside the clipping region + * become invisible. + * + * 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. + * + * page - A page handle. + * clipPath - A handle to the clip path. (Does not take ownership.) + */ +FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertClipPath(FPDF_PAGE page, + FPDF_CLIPPATH clipPath); #ifdef __cplusplus } diff --git a/dependencies/pdfium/win/public/fpdfview.h b/dependencies/pdfium/win/public/fpdfview.h index 843814ce..8453ee66 100644 --- a/dependencies/pdfium/win/public/fpdfview.h +++ b/dependencies/pdfium/win/public/fpdfview.h @@ -10,6 +10,8 @@ #ifndef PUBLIC_FPDFVIEW_H_ #define PUBLIC_FPDFVIEW_H_ +#include + #if defined(_WIN32) && !defined(__WINDOWS__) #include #endif @@ -20,32 +22,44 @@ #define PDF_USE_XFA #endif // PDF_ENABLE_XFA -// PDF types -typedef void* FPDF_ACTION; -typedef void* FPDF_BITMAP; -typedef void* FPDF_BOOKMARK; -typedef void* FPDF_CLIPPATH; -typedef void* FPDF_DEST; -typedef void* FPDF_DOCSCHHANDLE; -typedef void* FPDF_DOCUMENT; -typedef void* FPDF_FONT; -typedef void* FPDF_HMODULE; -typedef void* FPDF_LINK; -typedef void* FPDF_MODULEMGR; -typedef void* FPDF_PAGE; -typedef void* FPDF_PAGELINK; -typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc) -typedef void* FPDF_PAGERANGE; -typedef void* FPDF_PATH; -typedef void* FPDF_RECORDER; -typedef void* FPDF_SCHHANDLE; -typedef void* FPDF_STRUCTELEMENT; -typedef void* FPDF_STRUCTTREE; -typedef void* FPDF_TEXTPAGE; +// PDF object types +#define FPDF_OBJECT_UNKNOWN 0 +#define FPDF_OBJECT_BOOLEAN 1 +#define FPDF_OBJECT_NUMBER 2 +#define FPDF_OBJECT_STRING 3 +#define FPDF_OBJECT_NAME 4 +#define FPDF_OBJECT_ARRAY 5 +#define FPDF_OBJECT_DICTIONARY 6 +#define FPDF_OBJECT_STREAM 7 +#define FPDF_OBJECT_NULLOBJ 8 +#define FPDF_OBJECT_REFERENCE 9 + +// PDF types - use incomplete types for type safety. +typedef const struct fpdf_action_t__* FPDF_ACTION; +typedef struct fpdf_annotation_t__* FPDF_ANNOTATION; +typedef struct fpdf_attachment_t__* FPDF_ATTACHMENT; +typedef struct fpdf_bitmap_t__* FPDF_BITMAP; +typedef const struct fpdf_bookmark_t__* FPDF_BOOKMARK; +typedef struct fpdf_clippath_t__* FPDF_CLIPPATH; +typedef const struct fpdf_dest_t__* FPDF_DEST; +typedef struct fpdf_document_t__* FPDF_DOCUMENT; +typedef struct fpdf_font_t__* FPDF_FONT; +typedef struct fpdf_form_handle_t__* FPDF_FORMHANDLE; +typedef struct fpdf_link_t__* FPDF_LINK; +typedef struct fpdf_page_t__* FPDF_PAGE; +typedef struct fpdf_pagelink_t__* FPDF_PAGELINK; +typedef struct fpdf_pageobject_t__* FPDF_PAGEOBJECT; // (text, path, etc.) +typedef struct fpdf_pageobjectmark_t__* FPDF_PAGEOBJECTMARK; +typedef const struct fpdf_pagerange_t__* FPDF_PAGERANGE; +typedef const struct fpdf_pathsegment_t* FPDF_PATHSEGMENT; +typedef void* FPDF_RECORDER; // Passed into skia. +typedef struct fpdf_schhandle_t__* FPDF_SCHHANDLE; +typedef struct fpdf_structelement_t__* FPDF_STRUCTELEMENT; +typedef struct fpdf_structtree_t__* FPDF_STRUCTTREE; +typedef struct fpdf_textpage_t__* FPDF_TEXTPAGE; #ifdef PDF_ENABLE_XFA -typedef void* FPDF_STRINGHANDLE; -typedef void* FPDF_WIDGET; +typedef struct fpdf_widget_t__* FPDF_WIDGET; #endif // PDF_ENABLE_XFA // Basic data types @@ -101,7 +115,14 @@ typedef struct _FPDF_BSTR { // system wide string by yourself. typedef const char* FPDF_STRING; -// Matrix for transformation. +// Matrix for transformation, in the form [a b c d e f], equivalent to: +// | a b 0 | +// | c d 0 | +// | e f 1 | +// +// Translation is performed with [1 0 0 1 tx ty]. +// Scaling is performed with [sx 0 0 sy 0 0]. +// See PDF Reference 1.7, 4.2.2 Common Transformations for more. typedef struct _FS_MATRIX_ { float a; float b; @@ -126,19 +147,26 @@ typedef struct _FS_RECTF_ { // Const Pointer to FS_RECTF structure. typedef const FS_RECTF* FS_LPCRECTF; -#if defined(_WIN32) && defined (_MSC_VER) +// Annotation enums. +typedef int FPDF_ANNOTATION_SUBTYPE; +typedef int FPDF_ANNOT_APPEARANCEMODE; + +// Dictionary value types. +typedef int FPDF_OBJECT_TYPE; + +#if defined(_WIN32) #if defined(FPDFSDK_EXPORTS) // On Windows system, functions are exported in a DLL -#define DLLEXPORT __declspec(dllexport) -#define STDCALL __stdcall -#else -#define DLLEXPORT __declspec(dllimport) -#define STDCALL __stdcall -#endif //FPDF_EXPORTS +#define FPDF_EXPORT __declspec(dllexport) +#define FPDF_CALLCONV __cdecl #else -#define DLLEXPORT __declspec(dllimport) -#define STDCALL __stdcall -#endif //WIN32 +#define FPDF_EXPORT __declspec(dllimport) +#define FPDF_CALLCONV __cdecl +#endif +#else +#define FPDF_EXPORT +#define FPDF_CALLCONV +#endif // Exported Functions #ifdef __cplusplus @@ -154,7 +182,7 @@ extern "C" { // Comments: // Convenience function to call FPDF_InitLibraryWithConfig() for // backwards comatibility purposes. -DLLEXPORT void STDCALL FPDF_InitLibrary(); +FPDF_EXPORT void FPDF_CALLCONV FPDF_InitLibrary(); // Process-wide options for initializing the library. typedef struct FPDF_LIBRARY_CONFIG_ { @@ -188,8 +216,8 @@ typedef struct FPDF_LIBRARY_CONFIG_ { // Comments: // You have to call this function before you can call any PDF // processing functions. -DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( - const FPDF_LIBRARY_CONFIG* config); +FPDF_EXPORT void FPDF_CALLCONV +FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config); // Function: FPDF_DestroyLibary // Release all resources allocated by the FPDFSDK library. @@ -202,7 +230,7 @@ DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( // the library. // After this function is called, you should not call any PDF // processing functions. -DLLEXPORT void STDCALL FPDF_DestroyLibrary(); +FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary(); // Policy for accessing the local machine time. #define FPDF_POLICY_MACHINETIME_ACCESS 0 @@ -215,8 +243,8 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary(); // enable - True to enable, false to disable the policy. // Return value: // None. -DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, - FPDF_BOOL enable); +FPDF_EXPORT void FPDF_CALLCONV FPDF_SetSandBoxPolicy(FPDF_DWORD policy, + FPDF_BOOL enable); #if defined(_WIN32) #if defined(PDFIUM_PRINT_TEXT_WITH_GDI) @@ -234,7 +262,7 @@ typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, // func - A function pointer. See description above. // Return value: // None. -DLLEXPORT void STDCALL +FPDF_EXPORT void FPDF_CALLCONV FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func); // Function: FPDF_SetPrintTextWithGDI @@ -244,20 +272,27 @@ FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func); // use_gdi - Set to true to enable printing text with GDI. // Return value: // None. -DLLEXPORT void STDCALL FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi); +FPDF_EXPORT void FPDF_CALLCONV FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi); #endif // PDFIUM_PRINT_TEXT_WITH_GDI -// Function: FPDF_SetPrintPostscriptLevel -// Set postscript printing level when printing on Windows. +// Function: FPDF_SetPrintMode +// Set printing mode when printing on Windows. // Experimental API. // Parameters: -// postscript_level - 0 to disable postscript printing, -// 2 to print with postscript level 2, -// 3 to print with postscript level 3. -// All other values are invalid. +// mode - FPDF_PRINTMODE_EMF to output EMF (default) +// FPDF_PRINTMODE_TEXTONLY to output text only (for charstream +// devices) +// FPDF_PRINTMODE_POSTSCRIPT2 to output level 2 PostScript into +// EMF as a series of GDI comments. +// FPDF_PRINTMODE_POSTSCRIPT3 to output level 3 PostScript into +// EMF as a series of GDI comments. +// FPDF_PRINTMODE_POSTSCRIPT2_PASSTHROUGH to output level 2 +// PostScript via ExtEscape() in PASSTHROUGH mode. +// FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH to output level 3 +// PostScript via ExtEscape() in PASSTHROUGH mode. // Return value: -// True if successful, false if unsucessful (typically invalid input). -DLLEXPORT FPDF_BOOL STDCALL FPDF_SetPrintPostscriptLevel(FPDF_BOOL use_gdi); +// True if successful, false if unsuccessful (typically invalid input). +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SetPrintMode(int mode); #endif // defined(_WIN32) // Function: FPDF_LoadDocument @@ -266,14 +301,21 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_SetPrintPostscriptLevel(FPDF_BOOL use_gdi); // file_path - Path to the PDF file (including extension). // password - A string used as the password for the PDF file. // If no password is needed, empty or NULL can be used. +// See comments below regarding the encoding. // Return value: // A handle to the loaded document, or NULL on failure. // Comments: // Loaded document can be closed by FPDF_CloseDocument(). // If this function fails, you can use FPDF_GetLastError() to retrieve // the reason why it failed. -DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, - FPDF_BYTESTRING password); +// +// The encoding for |password| can be either UTF-8 or Latin-1. PDFs, +// depending on the security handler revision, will only accept one or +// the other encoding. If |password|'s encoding and the PDF's expected +// encoding do not match, FPDF_LoadDocument() will automatically +// convert |password| to the other encoding. +FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV +FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BYTESTRING password); // Function: FPDF_LoadMemDocument // Open and load a PDF document from memory. @@ -289,13 +331,15 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, // The loaded document can be closed by FPDF_CloseDocument. // If this function fails, you can use FPDF_GetLastError() to retrieve // the reason why it failed. +// +// See the comments for FPDF_LoadDocument() regarding the encoding for +// |password|. // Notes: // If PDFium is built with the XFA module, the application should call // FPDF_LoadXFA() function after the PDF document loaded to support XFA // fields defined in the fpdfformfill.h file. -DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, - int size, - FPDF_BYTESTRING password); +FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV +FPDF_LoadMemDocument(const void* data_buf, int size, FPDF_BYTESTRING password); // Structure for custom file access. typedef struct { @@ -304,6 +348,7 @@ typedef struct { // A function pointer for getting a block of data from a specific position. // Position is specified by byte offset from the beginning of the file. + // The pointer to the buffer is never NULL and the size is never 0. // The position and size will never go out of range of the file length. // It may be possible for FPDFSDK to call this function multiple times for // the same position. @@ -403,7 +448,8 @@ typedef struct _FPDF_FILEHANDLER { FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size); } FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER; -#endif +#endif // PDF_ENABLE_XFA + // Function: FPDF_LoadCustomDocument // Load PDF document from a custom access descriptor. // Parameters: @@ -412,15 +458,19 @@ typedef struct _FPDF_FILEHANDLER { // Return value: // A handle to the loaded document, or NULL on failure. // Comments: -// The application must keep the file resources valid until the PDF -// document is closed. +// The application must keep the file resources |pFileAccess| points to +// valid until the returned FPDF_DOCUMENT is closed. |pFileAccess| +// itself does not need to outlive the FPDF_DOCUMENT. // -// The loaded document can be closed with FPDF_CloseDocument. +// The loaded document can be closed with FPDF_CloseDocument(). +// +// See the comments for FPDF_LoadDocument() regarding the encoding for +// |password|. // Notes: // If PDFium is built with the XFA module, the application should call // FPDF_LoadXFA() function after the PDF document loaded to support XFA // fields defined in the fpdfformfill.h file. -DLLEXPORT FPDF_DOCUMENT STDCALL +FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password); // Function: FPDF_GetFileVersion @@ -434,8 +484,8 @@ FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password); // Comments: // If the document was created by FPDF_CreateNewDocument, // then this function will always fail. -DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, - int* fileVersion); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetFileVersion(FPDF_DOCUMENT doc, + int* fileVersion); #define FPDF_ERR_SUCCESS 0 // No error. #define FPDF_ERR_UNKNOWN 1 // Unknown error. @@ -458,7 +508,22 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, // Comments: // If the previous SDK call succeeded, the return value of this // function is not defined. -DLLEXPORT unsigned long STDCALL FPDF_GetLastError(); +FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetLastError(); + +// Function: FPDF_DocumentHasValidCrossReferenceTable +// Whether the document's cross reference table is valid or not. +// Experimental API. +// Parameters: +// document - Handle to a document. Returned by FPDF_LoadDocument. +// Return value: +// True if the PDF parser did not encounter problems parsing the cross +// reference table. False if the parser could not parse the cross +// reference table and the table had to be rebuild from other data +// within the document. +// Comments: +// The return value can change over time as the PDF parser evolves. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV +FPDF_DocumentHasValidCrossReferenceTable(FPDF_DOCUMENT document); // Function: FPDF_GetDocPermission // Get file permission flags of the document. @@ -468,7 +533,8 @@ DLLEXPORT unsigned long STDCALL FPDF_GetLastError(); // A 32-bit integer indicating permission flags. Please refer to the // PDF Reference for detailed descriptions. If the document is not // protected, 0xffffffff will be returned. -DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDF_GetDocPermissions(FPDF_DOCUMENT document); // Function: FPDF_GetSecurityHandlerRevision // Get the revision for the security handler. @@ -478,7 +544,8 @@ DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); // The security handler revision number. Please refer to the PDF // Reference for a detailed description. If the document is not // protected, -1 will be returned. -DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document); +FPDF_EXPORT int FPDF_CALLCONV +FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document); // Function: FPDF_GetPageCount // Get total number of pages in the document. @@ -486,7 +553,7 @@ DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document); // document - Handle to document. Returned by FPDF_LoadDocument. // Return value: // Total number of pages in the document. -DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); +FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageCount(FPDF_DOCUMENT document); // Function: FPDF_LoadPage // Load a page inside the document. @@ -498,8 +565,8 @@ DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); // Comments: // The loaded page can be rendered to devices using FPDF_RenderPage. // The loaded page can be closed using FPDF_ClosePage. -DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, - int page_index); +FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document, + int page_index); // Function: FPDF_GetPageWidth // Get page width. @@ -508,7 +575,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, // Return value: // Page width (excluding non-displayable area) measured in points. // One point is 1/72 inch (around 0.3528 mm). -DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); +FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageWidth(FPDF_PAGE page); // Function: FPDF_GetPageHeight // Get page height. @@ -517,7 +584,20 @@ DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); // Return value: // Page height (excluding non-displayable area) measured in points. // One point is 1/72 inch (around 0.3528 mm) -DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); +FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageHeight(FPDF_PAGE page); + +// Experimental API. +// Function: FPDF_GetPageBoundingBox +// Get the bounding box of the page. This is the intersection between +// its media box and its crop box. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// rect - Pointer to a rect to receive the page bounding box. +// On an error, |rect| won't be filled. +// Return value: +// True for success. +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetPageBoundingBox(FPDF_PAGE page, + FS_RECTF* rect); // Function: FPDF_GetPageSizeByIndex // Get the size of the page at the given index. @@ -530,10 +610,10 @@ DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); // (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); +FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, + int page_index, + double* width, + double* height); // Page rendering flags. They can be combined with bit-wise OR. // @@ -587,14 +667,14 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, // defined above. // Return value: // None. -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); +FPDF_EXPORT void FPDF_CALLCONV 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 @@ -602,7 +682,8 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, // Parameters: // bitmap - Handle to the device independent bitmap (as the // output buffer). The bitmap handle can be created -// by FPDFBitmap_Create. +// by FPDFBitmap_Create or retrieved from an image +// object by FPDFImageObj_GetBitmap. // page - Handle to the page. Returned by FPDF_LoadPage // start_x - Left pixel position of the display area in // bitmap coordinates. @@ -622,41 +703,44 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, // widget and popup annotations. // Return value: // None. -DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, - FPDF_PAGE page, - int start_x, - int start_y, - int size_x, - int size_y, - int rotate, - int flags); +FPDF_EXPORT void FPDF_CALLCONV 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_RenderPageBitmapWithMatrix // Render contents of a page to a device independent bitmap. // Parameters: // bitmap - Handle to the device independent bitmap (as the // output buffer). The bitmap handle can be created -// by FPDFBitmap_Create. -// page - Handle to the page. Returned by FPDF_LoadPage -// matrix - The transform matrix. -// clipping - The rect to clip to. +// by FPDFBitmap_Create or retrieved by +// FPDFImageObj_GetBitmap. +// page - Handle to the page. Returned by FPDF_LoadPage. +// matrix - The transform matrix, which must be invertible. +// See PDF Reference 1.7, 4.2.2 Common Transformations. +// clipping - The rect to clip to in device coords. // flags - 0 for normal display, or combination of the Page // Rendering flags defined above. With the FPDF_ANNOT // flag, it renders all annotations that do not require // user-interaction, which are all annotations except // widget and popup annotations. // Return value: -// None. -DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, - FPDF_PAGE page, - const FS_MATRIX* matrix, - const FS_RECTF* clipping, - int flags); +// None. Note that behavior is undefined if det of |matrix| is 0. +FPDF_EXPORT void FPDF_CALLCONV +FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, + FPDF_PAGE page, + const FS_MATRIX* matrix, + const FS_RECTF* clipping, + int flags); #ifdef _SKIA_SUPPORT_ -DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page, - int size_x, - int size_y); +FPDF_EXPORT FPDF_RECORDER FPDF_CALLCONV FPDF_RenderPageSkp(FPDF_PAGE page, + int size_x, + int size_y); #endif // Function: FPDF_ClosePage @@ -665,7 +749,7 @@ DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page, // page - Handle to the loaded page. // Return value: // None. -DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); +FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page); // Function: FPDF_CloseDocument // Close a loaded PDF document. @@ -673,7 +757,7 @@ DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); // document - Handle to the loaded document. // Return value: // None. -DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); +FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseDocument(FPDF_DOCUMENT document); // Function: FPDF_DeviceToPage // Convert the screen coordinates of a point to page coordinates. @@ -697,7 +781,8 @@ DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); // page_y - A pointer to a double receiving the converted Y // value in page coordinates. // Return value: -// None. +// Returns true if the conversion succeeds, and |page_x| and |page_y| +// successfully receives the converted coordinates. // Comments: // The page coordinate system has its origin at the left-bottom corner // of the page, with the X-axis on the bottom going to the right, and @@ -715,16 +800,16 @@ DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); // You must make sure the start_x, start_y, size_x, size_y // and rotate parameters have exactly same values as you used in // the 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); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 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 coordinates of a point to screen coordinates. @@ -748,19 +833,20 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, // device_y - A pointer to an integer receiving the result Y // value in device coordinates. // Return value: -// None. +// Returns true if the conversion succeeds, and |device_x| and +// |device_y| successfully receives the converted coordinates. // Comments: // See comments for FPDF_DeviceToPage(). -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); +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV 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 device independent bitmap (FXDIB). @@ -791,11 +877,13 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, // 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); +FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_Create(int width, + int height, + int alpha); // More DIB formats +// Unknown or unsupported format. +#define FPDFBitmap_Unknown 0 // Gray scale bitmap, one byte per pixel. #define FPDFBitmap_Gray 1 // 3 bytes per pixel, byte order: blue, green, red. @@ -830,11 +918,23 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, // If an external 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); +FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_CreateEx(int width, + int height, + int format, + void* first_scan, + int stride); + +// Function: FPDFBitmap_GetFormat +// Get the format of the bitmap. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create +// or FPDFImageObj_GetBitmap. +// Return value: +// The format of the bitmap. +// Comments: +// Only formats supported by FPDFBitmap_CreateEx are supported by this +// function; see the list of such formats above. +FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetFormat(FPDF_BITMAP bitmap); // Function: FPDFBitmap_FillRect // Fill a rectangle in a bitmap. @@ -860,17 +960,18 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, // background will be replaced by the source color and the alpha. // // If the 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); +FPDF_EXPORT void FPDF_CALLCONV FPDFBitmap_FillRect(FPDF_BITMAP bitmap, + int left, + int top, + int width, + int height, + FPDF_DWORD color); // Function: FPDFBitmap_GetBuffer // Get data buffer of a bitmap. // Parameters: -// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create +// or FPDFImageObj_GetBitmap. // Return value: // The pointer to the first byte of the bitmap buffer. // Comments: @@ -882,44 +983,48 @@ DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, // // The data is in BGRA format. Where the A maybe unused if alpha was // not specified. -DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); +FPDF_EXPORT void* FPDF_CALLCONV FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); // Function: FPDFBitmap_GetWidth // Get width of a bitmap. // Parameters: -// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create +// or FPDFImageObj_GetBitmap. // Return value: // The width of the bitmap in pixels. -DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); +FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); // Function: FPDFBitmap_GetHeight // Get height of a bitmap. // Parameters: -// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create +// or FPDFImageObj_GetBitmap. // Return value: // The height of the bitmap in pixels. -DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); +FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); // Function: FPDFBitmap_GetStride // Get number of bytes for each line in the bitmap buffer. // Parameters: -// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create +// or FPDFImageObj_GetBitmap. // Return value: // The number of bytes for each line in the bitmap buffer. // Comments: // The stride may be more than width * number of bytes per pixel. -DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); +FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetStride(FPDF_BITMAP bitmap); // Function: FPDFBitmap_Destroy // Destroy a bitmap and release all related buffers. // Parameters: -// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create +// or FPDFImageObj_GetBitmap. // Return value: // None. // Comments: // This function will not destroy any external buffers provided when // the bitmap was created. -DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); +FPDF_EXPORT void FPDF_CALLCONV FPDFBitmap_Destroy(FPDF_BITMAP bitmap); // Function: FPDF_VIEWERREF_GetPrintScaling // Whether the PDF document prefers to be scaled or not. @@ -927,7 +1032,7 @@ DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); // document - Handle to the loaded document. // Return value: // None. -DLLEXPORT FPDF_BOOL STDCALL +FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); // Function: FPDF_VIEWERREF_GetNumCopies @@ -936,7 +1041,8 @@ FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); // document - Handle to the loaded document. // Return value: // The number of copies to be printed. -DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); +FPDF_EXPORT int FPDF_CALLCONV +FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); // Function: FPDF_VIEWERREF_GetPrintPageRange // Page numbers to initialize print dialog box when file is printed. @@ -944,9 +1050,31 @@ DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); // document - Handle to the loaded document. // Return value: // The print page range to be used for printing. -DLLEXPORT FPDF_PAGERANGE STDCALL +FPDF_EXPORT FPDF_PAGERANGE FPDF_CALLCONV FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); +// Function: FPDF_VIEWERREF_GetPrintPageRangeCount +// Returns the number of elements in a FPDF_PAGERANGE. +// Experimental API. +// Parameters: +// pagerange - Handle to the page range. +// Return value: +// The number of elements in the page range. Returns 0 on error. +FPDF_EXPORT size_t FPDF_CALLCONV +FPDF_VIEWERREF_GetPrintPageRangeCount(FPDF_PAGERANGE pagerange); + +// Function: FPDF_VIEWERREF_GetPrintPageRangeElement +// Returns an element from a FPDF_PAGERANGE. +// Experimental API. +// Parameters: +// pagerange - Handle to the page range. +// index - Index of the element. +// Return value: +// The value of the element in the page range at a given index. +// Returns -1 on error. +FPDF_EXPORT int FPDF_CALLCONV +FPDF_VIEWERREF_GetPrintPageRangeElement(FPDF_PAGERANGE pagerange, size_t index); + // Function: FPDF_VIEWERREF_GetDuplex // Returns the paper handling option to be used when printing from // the print dialog. @@ -954,7 +1082,7 @@ FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); // document - Handle to the loaded document. // Return value: // The paper handling option to be used when printing. -DLLEXPORT FPDF_DUPLEXTYPE STDCALL +FPDF_EXPORT FPDF_DUPLEXTYPE FPDF_CALLCONV FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); // Function: FPDF_VIEWERREF_GetName @@ -962,7 +1090,8 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); // be of type "name". // Parameters: // document - Handle to the loaded document. -// key - Name of the key in the viewer pref dictionary. +// key - Name of the key in the viewer pref dictionary, +// encoded in UTF-8. // buffer - A string to write the contents of the key to. // length - Length of the buffer. // Return value: @@ -971,10 +1100,11 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); // as when |document| is invalid or |buffer| is NULL. If |length| is // less than the returned length, or |buffer| is NULL, |buffer| will // not be modified. -DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document, - FPDF_BYTESTRING key, - char* buffer, - unsigned long length); +FPDF_EXPORT unsigned long FPDF_CALLCONV +FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document, + FPDF_BYTESTRING key, + char* buffer, + unsigned long length); // Function: FPDF_CountNamedDests // Get the count of named destinations in the PDF document. @@ -982,7 +1112,8 @@ DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document, // document - Handle to a document // Return value: // The count of named destinations. -DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document); +FPDF_EXPORT FPDF_DWORD FPDF_CALLCONV +FPDF_CountNamedDests(FPDF_DOCUMENT document); // Function: FPDF_GetNamedDestByName // Get a the destination handle for the given name. @@ -991,8 +1122,8 @@ DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document); // name - The name of a destination. // Return value: // The handle to the destination. -DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, - FPDF_BYTESTRING name); +FPDF_EXPORT FPDF_DEST FPDF_CALLCONV +FPDF_GetNamedDestByName(FPDF_DOCUMENT document, FPDF_BYTESTRING name); // Function: FPDF_GetNamedDest // Get the named destination by index. @@ -1015,25 +1146,38 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, // // 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); +FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document, + int index, + void* buffer, + long* buflen); + +#ifdef PDF_ENABLE_V8 +// Function: FPDF_GetRecommendedV8Flags +// Returns a space-separated string of command line flags that are +// recommended to be passed into V8 via V8::SetFlagsFromString() +// prior to initializing the PDFium library. +// Parameters: +// None. +// Return value: +// NUL-terminated string of the form "--flag1 --flag2". +// The caller must not attempt to modify or free the result. +FPDF_EXPORT const char* FPDF_CALLCONV FPDF_GetRecommendedV8Flags(); +#endif // PDF_ENABLE_V8 #ifdef PDF_ENABLE_XFA // Function: FPDF_BStr_Init // Helper function to initialize a byte string. -DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str); +FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV 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); +FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Set(FPDF_BSTR* str, + FPDF_LPCSTR bstr, + int length); // Function: FPDF_BStr_Clear // Helper function to clear a byte string. -DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str); +FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Clear(FPDF_BSTR* str); #endif // PDF_ENABLE_XFA #ifdef __cplusplus diff --git a/dependencies/pdfium/win/x64/pdfium.dll b/dependencies/pdfium/win/x64/pdfium.dll index 005b03fb..b0103535 100644 Binary files a/dependencies/pdfium/win/x64/pdfium.dll and b/dependencies/pdfium/win/x64/pdfium.dll differ diff --git a/dependencies/pdfium/win/x64/pdfium.lib b/dependencies/pdfium/win/x64/pdfium.lib index 49e8c538..a0f1fd36 100644 Binary files a/dependencies/pdfium/win/x64/pdfium.lib and b/dependencies/pdfium/win/x64/pdfium.lib differ diff --git a/dependencies/pdfium/win/x86/pdfium.dll b/dependencies/pdfium/win/x86/pdfium.dll index e3cec0d0..874694d0 100644 Binary files a/dependencies/pdfium/win/x86/pdfium.dll and b/dependencies/pdfium/win/x86/pdfium.dll differ diff --git a/dependencies/pdfium/win/x86/pdfium.lib b/dependencies/pdfium/win/x86/pdfium.lib index fc28dc0c..506fa074 100644 Binary files a/dependencies/pdfium/win/x86/pdfium.lib and b/dependencies/pdfium/win/x86/pdfium.lib differ