Windows: Update bundled pdfium to r3729

This commit is contained in:
Felix Kauselmann
2019-04-28 11:38:25 +02:00
parent 7ae8afffb1
commit c1c413a72d
19 changed files with 2966 additions and 1298 deletions

View File

@ -59,14 +59,14 @@ typedef void* FPDF_AVAIL;
// //
// Returns a handle to the document availability provider, or NULL on error. // Returns a handle to the document availability provider, or NULL on error.
// //
// |FPDFAvail_Destroy| must be called when done with the availability provider. // FPDFAvail_Destroy() must be called when done with the availability provider.
DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail, FPDF_EXPORT FPDF_AVAIL FPDF_CALLCONV FPDFAvail_Create(FX_FILEAVAIL* file_avail,
FPDF_FILEACCESS* file); FPDF_FILEACCESS* file);
// Destroy the |avail| document availability provider. // Destroy the |avail| document availability provider.
// //
// avail - handle to document availability provider to be destroyed. // 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. // Download hints interface. Used to receive hints for further downloading.
typedef struct _FX_DOWNLOADHINTS { typedef struct _FX_DOWNLOADHINTS {
@ -103,11 +103,12 @@ typedef struct _FX_DOWNLOADHINTS {
// Applications should call this function whenever new data arrives, and process // Applications should call this function whenever new data arrives, and process
// all the generated download hints, if any, until the function returns // all the generated download hints, if any, until the function returns
// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. // |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. // handle.
DLLEXPORT int STDCALL FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsDocAvail(FPDF_AVAIL avail,
FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints); FX_DOWNLOADHINTS* hints);
// Get document from the availability provider. // Get document from the availability provider.
// //
@ -116,10 +117,12 @@ FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
// //
// Returns a handle to the document. // 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. // retrieve the document handle.
DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail, // See the comments for FPDF_LoadDocument() regarding the encoding for
FPDF_BYTESTRING password); // |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. // 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, // For most linearized PDFs, the first available page will be the first page,
// however, some PDFs might make another page the first available page. // however, some PDFs might make another page the first available page.
// For non-linearized PDFs, this function will always return zero. // 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 // Check if |page_index| is ready for loading, if not, get the
// |FX_DOWNLOADHINTS|. // |FX_DOWNLOADHINTS|.
@ -145,12 +148,14 @@ DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc);
// PDF_DATA_NOTAVAIL: Data not yet available. // PDF_DATA_NOTAVAIL: Data not yet available.
// PDF_DATA_AVAIL: Data 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 // Applications should call this function whenever new data arrives and process
// all the generated download |hints|, if any, until this function returns // all the generated download |hints|, if any, until this function returns
// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. Applications can then perform page // |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. Applications can then perform page
// loading. // loading.
DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, // 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, int page_index,
FX_DOWNLOADHINTS* hints); FX_DOWNLOADHINTS* hints);
@ -167,13 +172,15 @@ DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
// PDF_FORM_AVAIL: Data available. // PDF_FORM_AVAIL: Data available.
// PDF_FORM_NOTEXIST: No form data. // 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 // The application should call this function whenever new data arrives and
// process all the generated download |hints|, if any, until the function // process all the generated download |hints|, if any, until the function
// |PDF_FORM_ERROR|, |PDF_FORM_AVAIL| or |PDF_FORM_NOTEXIST|. // |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 // Applications can then perform page loading. It is recommend to call
// |FPDFDOC_InitFormFillEnvironment| when |PDF_FORM_AVAIL| is returned. // FPDFDOC_InitFormFillEnvironment() when |PDF_FORM_AVAIL| is returned.
DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, FPDF_EXPORT int FPDF_CALLCONV FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
FX_DOWNLOADHINTS* hints); FX_DOWNLOADHINTS* hints);
// Check whether a document is a linearized PDF. // Check whether a document is a linearized PDF.
@ -185,11 +192,11 @@ DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
// PDF_NOT_LINEARIZED // PDF_NOT_LINEARIZED
// PDF_LINEARIZATION_UNKNOWN // 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 // 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 // |PDF_LINEARIZATION_UNKNOWN| as there is insufficient information to determine
// if the PDF is linearlized. // 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 #ifdef __cplusplus
} // extern "C" } // extern "C"

View File

@ -25,6 +25,17 @@ extern "C" {
// Launch an application or open a file. // Launch an application or open a file.
#define PDFACTION_LAUNCH 4 #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 { typedef struct _FS_QUADPOINTSF {
FS_FLOAT x1; FS_FLOAT x1;
FS_FLOAT y1; 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 // 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. // 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); FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// Get the next sibling of |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 // Returns a handle to the next sibling of |bookmark|, or NULL if this is the
// last bookmark at this level. // last bookmark at this level.
DLLEXPORT FPDF_BOOKMARK STDCALL FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark); FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// Get the title of |bookmark|. // Get the title of |bookmark|.
@ -70,7 +81,8 @@ FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The // 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 // 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. // required length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark,
void* buffer, void* buffer,
unsigned long buflen); unsigned long buflen);
@ -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. // 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|. // multiple bookmarks have the same |title|.
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDF_WIDESTRING title); FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title);
// Get the destination associated with |bookmark|. // 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 // Returns the handle to the destination data, NULL if no destination is
// associated with |bookmark|. // associated with |bookmark|.
DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_EXPORT FPDF_DEST FPDF_CALLCONV
FPDF_BOOKMARK bookmark); FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// Get the action associated with |bookmark|. // Get the action associated with |bookmark|.
// //
// bookmark - handle to the bookmark. // bookmark - handle to the bookmark.
// //
// Returns the handle to the action data, or NULL if no action is associated // 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. // 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|. // Get the type of |action|.
// //
@ -115,7 +128,7 @@ DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
// PDFACTION_REMOTEGOTO // PDFACTION_REMOTEGOTO
// PDFACTION_URI // PDFACTION_URI
// PDFACTION_LAUNCH // 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|. // Get the destination of |action|.
// //
@ -123,42 +136,47 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action);
// action - handle to the action. |action| must be a |PDFACTION_GOTO| or // action - handle to the action. |action| must be a |PDFACTION_GOTO| or
// |PDFACTION_REMOTEGOTO|. // |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 // In the case of |PDFACTION_REMOTEGOTO|, you must first call
// |FPDFAction_GetFilePath| then load that document, the document handle from // FPDFAction_GetFilePath(), then load the document at that path, then pass
// that document should pass as |document| to |FPDFAction_GetDest|. // the document handle from that document as |document| to FPDFAction_GetDest().
DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document,
FPDF_ACTION action); 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 // 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. // buffer - a buffer for output the path string. May be NULL.
// buflen - the length of the buffer, in bytes. May be 0. // buflen - the length of the buffer, in bytes. May be 0.
// //
// Returns the number of bytes in the file path, including the trailing UTF16 // Returns the number of bytes in the file path, including the trailing NUL
// NUL character. // 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| // If |buflen| is less than the returned length, or |buffer| is NULL, |buffer|
// will not be modified. // will not be modified.
DLLEXPORT unsigned long STDCALL FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen); 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. // document - handle to the document.
// action - handle to the action. Must be a |PDFACTION_URI|. // action - handle to the action. Must be a |PDFACTION_URI|.
// buffer - a buffer for the path string. May be NULL. // buffer - a buffer for the path string. May be NULL.
// buflen - the length of the buffer, in bytes. May be 0. // 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 // 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. // returned length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDFAction_GetURIPath(FPDF_DOCUMENT document,
FPDF_ACTION action, FPDF_ACTION action,
void* buffer, void* buffer,
unsigned long buflen); unsigned long buflen);
@ -168,10 +186,22 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document,
// document - handle to the document. // document - handle to the document.
// dest - handle to the destination. // dest - handle to the destination.
// //
// Returns the page index containing |dest|. Page indices start from 0. // Returns the 0-based page index containing |dest|. Returns -1 on error.
DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FPDF_EXPORT int FPDF_CALLCONV FPDFDest_GetDestPageIndex(FPDF_DOCUMENT document,
FPDF_DEST dest); 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 // Get the (x, y, zoom) location of |dest| in the destination page, if the
// destination is in [page /XYZ x y zoom] syntax. // destination is in [page /XYZ x y zoom] syntax.
// //
@ -186,7 +216,8 @@ DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document,
// //
// Note the [x, y, zoom] values are only set if the corresponding hasXVal, // Note the [x, y, zoom] values are only set if the corresponding hasXVal,
// hasYVal or hasZoomVal flags are true. // hasYVal or hasZoomVal flags are true.
DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST dest, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFDest_GetLocationInPage(FPDF_DEST dest,
FPDF_BOOL* hasXCoord, FPDF_BOOL* hasXCoord,
FPDF_BOOL* hasYCoord, FPDF_BOOL* hasYCoord,
FPDF_BOOL* hasZoom, FPDF_BOOL* hasZoom,
@ -203,8 +234,8 @@ 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. // 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 // You can convert coordinates from screen coordinates to page coordinates using
// |FPDF_DeviceToPage|. // FPDF_DeviceToPage().
DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
double x, double x,
double y); double y);
@ -218,9 +249,10 @@ DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
// Larger Z-order numbers are closer to the front. // Larger Z-order numbers are closer to the front.
// //
// You can convert coordinates from screen coordinates to page coordinates using // You can convert coordinates from screen coordinates to page coordinates using
// |FPDF_DeviceToPage|. // FPDF_DeviceToPage().
DLLEXPORT int STDCALL FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page,
FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y); double x,
double y);
// Get destination info for |link|. // Get destination info for |link|.
// //
@ -228,9 +260,9 @@ FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y);
// link - handle to the link. // link - handle to the link.
// //
// Returns a handle to the destination, or NULL if there is no destination // 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|. // to retrieve the action associated with |link|.
DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document,
FPDF_LINK link); FPDF_LINK link);
// Get action info for |link|. // Get action info for |link|.
@ -238,46 +270,47 @@ DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document,
// link - handle to the link. // link - handle to the link.
// //
// Returns a handle to the action associated to |link|, or NULL if no action. // 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|. // Enumerates all the link annotations in |page|.
// //
// page - handle to the page. // page - handle to the page.
// startPos - the start position, should initially be 0 and is updated with // start_pos - the start position, should initially be 0 and is updated with
// the next start position on return. // the next start position on return.
// linkAnnot - the link handle for |startPos|. // link_annot - the link handle for |startPos|.
// //
// Returns TRUE on success. // Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page,
int* startPos, int* start_pos,
FPDF_LINK* linkAnnot); FPDF_LINK* link_annot);
// Get the rectangle for |linkAnnot|. // Get the rectangle for |link_annot|.
// //
// linkAnnot - handle to the link annotation. // link_annot - handle to the link annotation.
// rect - the annotation rectangle. // rect - the annotation rectangle.
// //
// Returns true on success. // Returns true on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetAnnotRect(FPDF_LINK link_annot,
FS_RECTF* rect); 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. // 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. // link_annot - handle to the link annotation.
// quadIndex - the specified quad point index. // quad_index - the specified quad point index.
// quadPoints - receives the quadrilateral points. // quad_points - receives the quadrilateral points.
// //
// Returns true on success. // Returns true on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
int quadIndex, FPDFLink_GetQuadPoints(FPDF_LINK link_annot,
FS_QUADPOINTSF* quadPoints); int quad_index,
FS_QUADPOINTSF* quad_points);
// Get meta-data |tag| content from |document|. // Get meta-data |tag| content from |document|.
// //
@ -296,7 +329,11 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two // 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 // 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. // the returned length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document, //
// 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, FPDF_BYTESTRING tag,
void* buffer, void* buffer,
unsigned long buflen); unsigned long buflen);
@ -313,7 +350,8 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document,
// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two // 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 // 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. // the returned length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDF_GetPageLabel(FPDF_DOCUMENT document, FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_GetPageLabel(FPDF_DOCUMENT document,
int page_index, int page_index,
void* buffer, void* buffer,
unsigned long buflen); unsigned long buflen);

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,8 @@
#ifndef PUBLIC_FPDF_EXT_H_ #ifndef PUBLIC_FPDF_EXT_H_
#define PUBLIC_FPDF_EXT_H_ #define PUBLIC_FPDF_EXT_H_
#include <time.h>
// NOLINTNEXTLINE(build/include) // NOLINTNEXTLINE(build/include)
#include "fpdfview.h" #include "fpdfview.h"
@ -64,9 +66,28 @@ typedef struct _UNSUPPORT_INFO {
// unsp_info - Pointer to an UNSUPPORT_INFO structure. // unsp_info - Pointer to an UNSUPPORT_INFO structure.
// //
// Returns TRUE on success. // Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info); 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. // Unknown page mode.
#define PAGEMODE_UNKNOWN -1 #define PAGEMODE_UNKNOWN -1
// Document outline, and thumbnails hidden. // Document outline, and thumbnails hidden.
@ -89,7 +110,7 @@ FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);
// Returns one of the |PAGEMODE_*| flags defined above. // Returns one of the |PAGEMODE_*| flags defined above.
// //
// The page mode defines how the document should be initially displayed. // 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 #ifdef __cplusplus
} // extern "C" } // extern "C"

View File

@ -35,7 +35,7 @@ extern "C" {
// //
// Currently, all failures return |FLATTEN_FAIL| with no indication of the // Currently, all failures return |FLATTEN_FAIL| with no indication of the
// cause. // 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 #ifdef __cplusplus
} // extern "C" } // extern "C"

File diff suppressed because it is too large Load Diff

View File

@ -23,19 +23,43 @@ extern "C" {
// index - The page index to insert at. // index - The page index to insert at.
// //
// Returns TRUE on success. // Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc, FPDF_DOCUMENT src_doc,
FPDF_BYTESTRING pagerange, FPDF_BYTESTRING pagerange,
int index); 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|. // Copy the viewer preferences from |src_doc| into |dest_doc|.
// //
// dest_doc - Document to write the viewer preferences into. // dest_doc - Document to write the viewer preferences into.
// src_doc - Document to read the viewer preferences from. // src_doc - Document to read the viewer preferences from.
// //
// Returns TRUE on success. // Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDF_DOCUMENT src_doc); FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"

View File

@ -11,8 +11,8 @@
#include "fpdfview.h" #include "fpdfview.h"
// Flags for progressive process status. // Flags for progressive process status.
#define FPDF_RENDER_READER 0 #define FPDF_RENDER_READY 0
#define FPDF_RENDER_TOBECOUNTINUED 1 #define FPDF_RENDER_TOBECONTINUED 1
#define FPDF_RENDER_DONE 2 #define FPDF_RENDER_DONE 2
#define FPDF_RENDER_FAILED 3 #define FPDF_RENDER_FAILED 3
@ -77,7 +77,7 @@ typedef struct _IFSDK_PAUSE {
// Rendering Status. See flags for progressive process status for the // Rendering Status. See flags for progressive process status for the
// details. // details.
// //
DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap, FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
FPDF_PAGE page, FPDF_PAGE page,
int start_x, int start_x,
int start_y, int start_y,
@ -99,7 +99,7 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
// Return value: // Return value:
// The rendering status. See flags for progressive process status for // The rendering status. See flags for progressive process status for
// the details. // the details.
DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page, FPDF_EXPORT int FPDF_CALLCONV FPDF_RenderPage_Continue(FPDF_PAGE page,
IFSDK_PAUSE* pause); IFSDK_PAUSE* pause);
// Function: FPDF_RenderPage_Close // Function: FPDF_RenderPage_Close
@ -111,7 +111,7 @@ DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,
// function. // function.
// Return value: // Return value:
// NULL // NULL
DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page); FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage_Close(FPDF_PAGE page);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -59,7 +59,7 @@ typedef struct FPDF_FILEWRITE_ {
// Return value: // Return value:
// TRUE for succeed, FALSE for failed. // TRUE for succeed, FALSE for failed.
// //
DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SaveAsCopy(FPDF_DOCUMENT document,
FPDF_FILEWRITE* pFileWrite, FPDF_FILEWRITE* pFileWrite,
FPDF_DWORD flags); FPDF_DWORD flags);
@ -75,7 +75,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document,
// Return value: // Return value:
// TRUE if succeed, FALSE if failed. // TRUE if succeed, FALSE if failed.
// //
DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDF_SaveWithVersion(FPDF_DOCUMENT document,
FPDF_FILEWRITE* pFileWrite, FPDF_FILEWRITE* pFileWrite,
FPDF_DWORD flags, FPDF_DWORD flags,
int fileVersion); int fileVersion);

View File

@ -17,12 +17,21 @@ extern "C" {
// Get the character index in |text_page| internal character list. // Get the character index in |text_page| internal character list.
// //
// text_page - a text page information structure. // 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. // 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); 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 #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif // __cplusplus #endif // __cplusplus

View File

@ -21,7 +21,8 @@ extern "C" {
// function. // function.
// Return value: // Return value:
// A handle to the structure tree or NULL on error. // 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 // Function: FPDF_StructTree_Close
// Release the resource allocate by FPDF_StructTree_GetForPage. // 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. // FPDF_StructTree_LoadPage function.
// Return value: // Return value:
// NULL // 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 // Function: FPDF_StructTree_CountChildren
// Count the number of children for the structure tree. // 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. // FPDF_StructTree_LoadPage function.
// Return value: // Return value:
// The number of children, or -1 on error. // The number of children, or -1 on error.
DLLEXPORT int STDCALL FPDF_EXPORT int FPDF_CALLCONV
FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree); FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree);
// Function: FPDF_StructTree_GetChildAtIndex // Function: FPDF_StructTree_GetChildAtIndex
@ -50,7 +52,7 @@ FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree);
// index - The index for the child, 0-based. // index - The index for the child, 0-based.
// Return value: // Return value:
// The child at the n-th index or NULL on error. // 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); FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index);
// Function: FPDF_StructElement_GetAltText // 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 // encoding. The string is terminated by a UTF16 NUL character. If
// |buflen| is less than the required length, or |buffer| is NULL, // |buflen| is less than the required length, or |buffer| is NULL,
// |buffer| will not be modified. // |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element, FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element,
void* buffer, void* buffer,
unsigned long buflen); 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 // Function: FPDF_StructElement_CountChildren
// Count the number of children for the structure element. // Count the number of children for the structure element.
// Parameters: // Parameters:
// struct_element - Handle to the struct element. // struct_element - Handle to the struct element.
// Return value: // Return value:
// The number of children, or -1 on error. // The number of children, or -1 on error.
DLLEXPORT int STDCALL FPDF_EXPORT int FPDF_CALLCONV
FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element); FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element);
// Function: FPDF_StructElement_GetChildAtIndex // Function: FPDF_StructElement_GetChildAtIndex
@ -92,12 +144,12 @@ FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element);
// Comments: // Comments:
// If the child exists but is not an element, then this function will // 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. // 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, FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
int index); int index);
#ifdef __cplusplus #ifdef __cplusplus
} } // extern "C"
#endif #endif
#endif // PUBLIC_FPDF_STRUCTTREE_H_ #endif // PUBLIC_FPDF_STRUCTTREE_H_

View File

@ -20,7 +20,7 @@
#define FXFONT_CHINESEBIG5_CHARSET 136 #define FXFONT_CHINESEBIG5_CHARSET 136
/* Font pitch and family flags */ /* 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_ROMAN (1 << 4)
#define FXFONT_FF_SCRIPT (4 << 4) #define FXFONT_FF_SCRIPT (4 << 4)
@ -106,10 +106,7 @@ typedef struct _FPDF_SYSFONTINFO {
*constants. *constants.
* face - Typeface name. Currently use system local encoding * face - Typeface name. Currently use system local encoding
*only. *only.
* bExact - Pointer to a boolean value receiving the indicator * bExact - Obsolete: this parameter is now ignored.
*whether mapper found the exact match.
* If mapper is not sure whether it's exact match,
*ignore this paramter.
* Return Value: * Return Value:
* An opaque pointer for font handle, or NULL if system mapping is * An opaque pointer for font handle, or NULL if system mapping is
*not supported. *not supported.
@ -244,7 +241,7 @@ typedef struct FPDF_CharsetFontMap_ {
* Return Value: * Return Value:
* Pointer to the Charset Font Map. * 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 * Function: FPDF_AddInstalledFont
@ -259,7 +256,7 @@ DLLEXPORT const FPDF_CharsetFontMap* STDCALL FPDF_GetDefaultTTFMap();
* Return Value: * Return Value:
* None. * None.
**/ **/
DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, FPDF_EXPORT void FPDF_CALLCONV FPDF_AddInstalledFont(void* mapper,
const char* face, const char* face,
int charset); int charset);
@ -275,7 +272,8 @@ DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper,
* Return Value: * Return Value:
* None * None
**/ **/
DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); FPDF_EXPORT void FPDF_CALLCONV
FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
/** /**
* Function: FPDF_GetDefaultSystemFontInfo * Function: FPDF_GetDefaultSystemFontInfo
@ -294,7 +292,7 @@ DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
* Application should call FPDF_FreeDefaultSystemFontInfo to free the * Application should call FPDF_FreeDefaultSystemFontInfo to free the
*returned pointer. *returned pointer.
**/ **/
DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo(); FPDF_EXPORT FPDF_SYSFONTINFO* FPDF_CALLCONV FPDF_GetDefaultSystemFontInfo();
/** /**
* Function: FPDF_FreeDefaultSystemFontInfo * Function: FPDF_FreeDefaultSystemFontInfo
@ -307,7 +305,8 @@ DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo();
* Return Value: * Return Value:
* None * None
**/ **/
DLLEXPORT void FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); FPDF_EXPORT void FPDF_CALLCONV
FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -27,7 +27,7 @@ extern "C" {
// Application must call FPDFText_ClosePage to release the text page // Application must call FPDFText_ClosePage to release the text page
// information. // information.
// //
DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page); FPDF_EXPORT FPDF_TEXTPAGE FPDF_CALLCONV FPDFText_LoadPage(FPDF_PAGE page);
// Function: FPDFText_ClosePage // Function: FPDFText_ClosePage
// Release all resources allocated for a text page information // Release all resources allocated for a text page information
@ -38,7 +38,7 @@ DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page);
// Return Value: // Return Value:
// None. // None.
// //
DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page); FPDF_EXPORT void FPDF_CALLCONV FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
// Function: FPDFText_CountChars // Function: FPDFText_CountChars
// Get number of characters in a page. // 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 // first character in the page
// has an index value of zero. // 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 // Function: FPDFText_GetUnicode
// Get Unicode of a character in a page. // Get Unicode of a character in a page.
@ -70,8 +70,8 @@ DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page);
// convert to Unicode, // convert to Unicode,
// the return value will be zero. // the return value will be zero.
// //
DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, FPDF_EXPORT unsigned int FPDF_CALLCONV
int index); FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index);
// Function: FPDFText_GetFontSize // Function: FPDFText_GetFontSize
// Get the font size of a particular character. // Get the font size of a particular character.
@ -84,9 +84,34 @@ DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page,
// 1/72 inch). // 1/72 inch).
// This is the typographic size of the font (so called "em size"). // This is the typographic size of the font (so called "em size").
// //
DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, FPDF_EXPORT double FPDF_CALLCONV FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
int index); 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 // Function: FPDFText_GetCharBox
// Get bounding box of a particular character. // Get bounding box of a particular character.
// Parameters: // Parameters:
@ -102,17 +127,40 @@ DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
// top - Pointer to a double number receiving top position of // top - Pointer to a double number receiving top position of
// the character box. // the character box.
// Return Value: // 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: // Comments:
// All positions are measured in PDF "user space". // All positions are measured in PDF "user space".
// //
DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
int index, int index,
double* left, double* left,
double* right, double* right,
double* bottom, double* bottom,
double* top); 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 // Function: FPDFText_GetCharIndexAtPos
// Get the index of a character at or nearby a certain position on the // Get the index of a character at or nearby a certain position on the
// page. // page.
@ -131,7 +179,8 @@ DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
// be -1. // be -1.
// If an error occurs, -3 will be returned. // If an error occurs, -3 will be returned.
// //
DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, FPDF_EXPORT int FPDF_CALLCONV
FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
double x, double x,
double y, double y,
double xTolerance, double xTolerance,
@ -154,7 +203,7 @@ DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
// Comments: // Comments:
// This function ignores characters without unicode information. // This function ignores characters without unicode information.
// //
DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetText(FPDF_TEXTPAGE text_page,
int start_index, int start_index,
int count, int count,
unsigned short* result); unsigned short* result);
@ -177,7 +226,7 @@ DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,
// one if those characters // one if those characters
// are on the same line and use same font settings. // are on the same line and use same font settings.
// //
DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountRects(FPDF_TEXTPAGE text_page,
int start_index, int start_index,
int count); int count);
@ -197,9 +246,13 @@ DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page,
// bottom - Pointer to a double value receiving the rectangle // bottom - Pointer to a double value receiving the rectangle
// bottom boundary. // bottom boundary.
// Return Value: // 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, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetRect(FPDF_TEXTPAGE text_page,
int rect_index, int rect_index,
double* left, double* left,
double* top, double* top,
@ -232,7 +285,7 @@ DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page,
// If the buffer is too small, as much text as will fit is copied into // If the buffer is too small, as much text as will fit is copied into
// it. // it.
// //
DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
double left, double left,
double top, double top,
double right, double right,
@ -241,10 +294,13 @@ DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
int buflen); int buflen);
// Flags used by FPDFText_FindStart function. // Flags used by FPDFText_FindStart function.
#define FPDF_MATCHCASE \ //
0x00000001 // If not set, it will not match case by default. // If not set, it will not match case by default.
#define FPDF_MATCHWHOLEWORD \ #define FPDF_MATCHCASE 0x00000001
0x00000002 // If not set, it will not match the whole word by default. // 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 // Function: FPDFText_FindStart
// Start a search. // Start a search.
@ -258,7 +314,8 @@ DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
// A handle for the search context. FPDFText_FindClose must be called // A handle for the search context. FPDFText_FindClose must be called
// to release this handle. // to release this handle.
// //
DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, FPDF_EXPORT FPDF_SCHHANDLE FPDF_CALLCONV
FPDFText_FindStart(FPDF_TEXTPAGE text_page,
FPDF_WIDESTRING findwhat, FPDF_WIDESTRING findwhat,
unsigned long flags, unsigned long flags,
int start_index); int start_index);
@ -271,7 +328,7 @@ DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page,
// Return Value: // Return Value:
// Whether a match is found. // 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 // Function: FPDFText_FindPrev
// Search in the direction from page end to start. // Search in the direction from page end to start.
@ -281,7 +338,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle);
// Return Value: // Return Value:
// Whether a match is found. // 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 // Function: FPDFText_GetSchResultIndex
// Get the starting character index of the search result. // Get the starting character index of the search result.
@ -291,7 +348,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle);
// Return Value: // Return Value:
// Index for the starting character. // 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 // Function: FPDFText_GetSchCount
// Get the number of matched characters in the search result. // Get the number of matched characters in the search result.
@ -301,7 +358,7 @@ DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
// Return Value: // Return Value:
// Number of matched characters. // 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 // Function: FPDFText_FindClose
// Release a search context. // Release a search context.
@ -311,7 +368,7 @@ DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
// Return Value: // Return Value:
// None. // None.
// //
DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle); FPDF_EXPORT void FPDF_CALLCONV FPDFText_FindClose(FPDF_SCHHANDLE handle);
// Function: FPDFLink_LoadWebLinks // Function: FPDFLink_LoadWebLinks
// Prepare information about weblinks in a page. // 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. // 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 // Function: FPDFLink_CountWebLinks
// Count number of detected web links. // Count number of detected web links.
@ -345,7 +403,7 @@ DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
// Return Value: // Return Value:
// Number of detected web links. // 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 // Function: FPDFLink_GetURL
// Fetch the URL information for a detected web link. // Fetch the URL information for a detected web link.
@ -366,7 +424,7 @@ DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
// If |link_index| does not correspond to a valid link, then the result // If |link_index| does not correspond to a valid link, then the result
// is an empty string. // is an empty string.
// //
DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetURL(FPDF_PAGELINK link_page,
int link_index, int link_index,
unsigned short* buffer, unsigned short* buffer,
int buflen); int buflen);
@ -380,7 +438,7 @@ DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page,
// Number of rectangular areas for the link. If |link_index| does // Number of rectangular areas for the link. If |link_index| does
// not correspond to a valid link, then 0 is returned. // not correspond to a valid link, then 0 is returned.
// //
DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountRects(FPDF_PAGELINK link_page,
int link_index); int link_index);
// Function: FPDFLink_GetRect // Function: FPDFLink_GetRect
@ -398,10 +456,12 @@ DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page,
// bottom - Pointer to a double value receiving the rectangle // bottom - Pointer to a double value receiving the rectangle
// bottom boundary. // bottom boundary.
// Return Value: // Return Value:
// None. If |link_index| does not correspond to a valid link, then // On success, return TRUE and fill in |left|, |top|, |right|, and
// |left|, |top|, |right|, and |bottom| remain unmodified. // |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, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetRect(FPDF_PAGELINK link_page,
int link_index, int link_index,
int rect_index, int rect_index,
double* left, double* left,
@ -416,7 +476,7 @@ DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page,
// Return Value: // Return Value:
// None. // None.
// //
DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page); FPDF_EXPORT void FPDF_CALLCONV FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -14,102 +14,204 @@
extern "C" { extern "C" {
#endif #endif
typedef void* FPDF_PAGEARCSAVER;
typedef void* FPDF_PAGEARCLOADER;
/** /**
* Set "MediaBox" entry to the page dictionary. * Set "MediaBox" entry to the page dictionary.
* @param[in] page - Handle to a page. *
* @param[in] left - The left of the rectangle. * page - Handle to a page.
* @param[in] bottom - The bottom of the rectangle. * left - The left of the rectangle.
* @param[in] right - The right of the rectangle. * bottom - The bottom of the rectangle.
* @param[in] top - The top of the rectangle. * right - The right of the rectangle.
* @retval None. * top - The top of the rectangle.
*/ */
DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetMediaBox(FPDF_PAGE page,
float left, float left,
float bottom, float bottom,
float right, float right,
float top); float top);
/** /**
* Set "CropBox" entry to the page dictionary. * Set "CropBox" entry to the page dictionary.
* @param[in] page - Handle to a page. *
* @param[in] left - The left of the rectangle. * page - Handle to a page.
* @param[in] bottom - The bottom of the rectangle. * left - The left of the rectangle.
* @param[in] right - The right of the rectangle. * bottom - The bottom of the rectangle.
* @param[in] top - The top of the rectangle. * right - The right of the rectangle.
* @retval None. * top - The top of the rectangle.
*/ */
DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetCropBox(FPDF_PAGE page,
float left, float left,
float bottom, float bottom,
float right, float right,
float top); float top);
/** Get "MediaBox" entry from the page dictionary. /**
* @param[in] page - Handle to a page. * Set "BleedBox" entry to the page dictionary.
* @param[in] left - Pointer to a double value receiving the left of the *
* rectangle. * page - Handle to a page.
* @param[in] bottom - Pointer to a double value receiving the bottom of the * left - The left of the rectangle.
* rectangle. * bottom - The bottom of the rectangle.
* @param[in] right - Pointer to a double value receiving the right of the * right - The right of the rectangle.
* rectangle. * top - The top of the rectangle.
* @param[in] top - Pointer to a double value receiving the top of the */
* rectangle. FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetBleedBox(FPDF_PAGE page,
* @retval True if success,else fail. float left,
*/ float bottom,
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page, float right,
float* left, float top);
float* bottom,
float* right,
float* top);
/** Get "CropBox" entry from the page dictionary. /**
* @param[in] page - Handle to a page. * Set "TrimBox" entry to the page dictionary.
* @param[in] left - Pointer to a double value receiving the left of the *
* rectangle. * page - Handle to a page.
* @param[in] bottom - Pointer to a double value receiving the bottom of the * left - The left of the rectangle.
* rectangle. * bottom - The bottom of the rectangle.
* @param[in] right - Pointer to a double value receiving the right of the * right - The right of the rectangle.
* rectangle. * top - The top of the rectangle.
* @param[in] top - Pointer to a double value receiving the top of the */
* rectangle. FPDF_EXPORT void FPDF_CALLCONV FPDFPage_SetTrimBox(FPDF_PAGE page,
* @retval True if success,else fail. float left,
*/ float bottom,
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page, float right,
float top);
/**
* 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* left,
float* bottom, float* bottom,
float* right, float* right,
float* top); float* top);
/** /**
* Transform the whole page with a specified matrix, then clip the page content * Get "CropBox" entry from the page dictionary.
* region. *
* * page - Handle to a page.
* @param[in] page - A page handle. * left - Pointer to a float value receiving the left of the rectangle.
* @param[in] matrix - The transform matrix. * bottom - Pointer to a float value receiving the bottom of the rectangle.
* @param[in] clipRect - A rectangle page area to be clipped. * right - Pointer to a float value receiving the right of the rectangle.
* @Note. This function will transform the whole page, and would take effect to * top - Pointer to a float value receiving the top of the rectangle.
* all the objects in the page. *
*/ * On success, return true and write to the out parameters. Otherwise return
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, * false and leave the out parameters unmodified.
FS_MATRIX* matrix, */
FS_RECTF* clipRect); FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GetCropBox(FPDF_PAGE page,
float* left,
float* bottom,
float* right,
float* top);
/** /**
* Transform (scale, rotate, shear, move) the clip path of page object. * Get "BleedBox" entry from the page dictionary.
* @param[in] page_object - Handle to a page object. Returned by *
* FPDFPageObj_NewImageObj. * page - Handle to a page.
* @param[in] a - The coefficient "a" of the matrix. * left - Pointer to a float value receiving the left of the rectangle.
* @param[in] b - The coefficient "b" of the matrix. * bottom - Pointer to a float value receiving the bottom of the rectangle.
* @param[in] c - The coefficient "c" of the matrix. * right - Pointer to a float value receiving the right of the rectangle.
* @param[in] d - The coefficient "d" of the matrix. * top - Pointer to a float value receiving the top of the rectangle.
* @param[in] e - The coefficient "e" of the matrix. *
* @param[in] f - The coefficient "f" of the matrix. * On success, return true and write to the out parameters. Otherwise return
* @retval None. * false and leave the out parameters unmodified.
*/ */
DLLEXPORT void STDCALL 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, FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,
double a, double a,
double b, double b,
@ -119,39 +221,39 @@ FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,
double f); double f);
/** /**
* Create a new clip path, with a rectangle inserted. * Create a new clip path, with a rectangle inserted.
* *
* @param[in] left - The left of the clip box. * Caller takes ownership of the returned FPDF_CLIPPATH. It should be freed with
* @param[in] bottom - The bottom of the clip box. * FPDF_DestroyClipPath().
* @param[in] right - The right of the clip box. *
* @param[in] top - The top of the clip box. * left - The left of the clip box.
* @retval a handle to the clip path. * bottom - The bottom of the clip box.
*/ * right - The right of the clip box.
DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, * top - The top of the clip box.
*/
FPDF_EXPORT FPDF_CLIPPATH FPDF_CALLCONV FPDF_CreateClipPath(float left,
float bottom, float bottom,
float right, float right,
float top); float top);
/** /**
* Destroy the clip path. * Destroy the clip path.
* *
* @param[in] clipPath - A handle to the clip path. * clipPath - A handle to the clip path. It will be invalid after this call.
* Destroy the clip path. */
* @retval None. FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
*/
DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
/** /**
* Clip the page content, the page content that outside the clipping region * Clip the page content, the page content that outside the clipping region
* become invisible. * become invisible.
* *
* @param[in] page - A page handle. * A clip path will be inserted before the page content stream or content array.
* @param[in] clipPath - A handle to the clip path. * In this way, the page content will be clipped by this 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 * page - A page handle.
* by this clip path. * clipPath - A handle to the clip path. (Does not take ownership.)
*/ */
DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page, FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertClipPath(FPDF_PAGE page,
FPDF_CLIPPATH clipPath); FPDF_CLIPPATH clipPath);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -10,6 +10,8 @@
#ifndef PUBLIC_FPDFVIEW_H_ #ifndef PUBLIC_FPDFVIEW_H_
#define PUBLIC_FPDFVIEW_H_ #define PUBLIC_FPDFVIEW_H_
#include <stddef.h>
#if defined(_WIN32) && !defined(__WINDOWS__) #if defined(_WIN32) && !defined(__WINDOWS__)
#include <windows.h> #include <windows.h>
#endif #endif
@ -20,32 +22,44 @@
#define PDF_USE_XFA #define PDF_USE_XFA
#endif // PDF_ENABLE_XFA #endif // PDF_ENABLE_XFA
// PDF types // PDF object types
typedef void* FPDF_ACTION; #define FPDF_OBJECT_UNKNOWN 0
typedef void* FPDF_BITMAP; #define FPDF_OBJECT_BOOLEAN 1
typedef void* FPDF_BOOKMARK; #define FPDF_OBJECT_NUMBER 2
typedef void* FPDF_CLIPPATH; #define FPDF_OBJECT_STRING 3
typedef void* FPDF_DEST; #define FPDF_OBJECT_NAME 4
typedef void* FPDF_DOCSCHHANDLE; #define FPDF_OBJECT_ARRAY 5
typedef void* FPDF_DOCUMENT; #define FPDF_OBJECT_DICTIONARY 6
typedef void* FPDF_FONT; #define FPDF_OBJECT_STREAM 7
typedef void* FPDF_HMODULE; #define FPDF_OBJECT_NULLOBJ 8
typedef void* FPDF_LINK; #define FPDF_OBJECT_REFERENCE 9
typedef void* FPDF_MODULEMGR;
typedef void* FPDF_PAGE; // PDF types - use incomplete types for type safety.
typedef void* FPDF_PAGELINK; typedef const struct fpdf_action_t__* FPDF_ACTION;
typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc) typedef struct fpdf_annotation_t__* FPDF_ANNOTATION;
typedef void* FPDF_PAGERANGE; typedef struct fpdf_attachment_t__* FPDF_ATTACHMENT;
typedef void* FPDF_PATH; typedef struct fpdf_bitmap_t__* FPDF_BITMAP;
typedef void* FPDF_RECORDER; typedef const struct fpdf_bookmark_t__* FPDF_BOOKMARK;
typedef void* FPDF_SCHHANDLE; typedef struct fpdf_clippath_t__* FPDF_CLIPPATH;
typedef void* FPDF_STRUCTELEMENT; typedef const struct fpdf_dest_t__* FPDF_DEST;
typedef void* FPDF_STRUCTTREE; typedef struct fpdf_document_t__* FPDF_DOCUMENT;
typedef void* FPDF_TEXTPAGE; 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 #ifdef PDF_ENABLE_XFA
typedef void* FPDF_STRINGHANDLE; typedef struct fpdf_widget_t__* FPDF_WIDGET;
typedef void* FPDF_WIDGET;
#endif // PDF_ENABLE_XFA #endif // PDF_ENABLE_XFA
// Basic data types // Basic data types
@ -101,7 +115,14 @@ typedef struct _FPDF_BSTR {
// system wide string by yourself. // system wide string by yourself.
typedef const char* FPDF_STRING; 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_ { typedef struct _FS_MATRIX_ {
float a; float a;
float b; float b;
@ -126,19 +147,26 @@ typedef struct _FS_RECTF_ {
// Const Pointer to FS_RECTF structure. // Const Pointer to FS_RECTF structure.
typedef const FS_RECTF* FS_LPCRECTF; 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) #if defined(FPDFSDK_EXPORTS)
// On Windows system, functions are exported in a DLL // On Windows system, functions are exported in a DLL
#define DLLEXPORT __declspec(dllexport) #define FPDF_EXPORT __declspec(dllexport)
#define STDCALL __stdcall #define FPDF_CALLCONV __cdecl
#else #else
#define DLLEXPORT __declspec(dllimport) #define FPDF_EXPORT __declspec(dllimport)
#define STDCALL __stdcall #define FPDF_CALLCONV __cdecl
#endif //FPDF_EXPORTS #endif
#else #else
#define DLLEXPORT __declspec(dllimport) #define FPDF_EXPORT
#define STDCALL __stdcall #define FPDF_CALLCONV
#endif //WIN32 #endif
// Exported Functions // Exported Functions
#ifdef __cplusplus #ifdef __cplusplus
@ -154,7 +182,7 @@ extern "C" {
// Comments: // Comments:
// Convenience function to call FPDF_InitLibraryWithConfig() for // Convenience function to call FPDF_InitLibraryWithConfig() for
// backwards comatibility purposes. // backwards comatibility purposes.
DLLEXPORT void STDCALL FPDF_InitLibrary(); FPDF_EXPORT void FPDF_CALLCONV FPDF_InitLibrary();
// Process-wide options for initializing the library. // Process-wide options for initializing the library.
typedef struct FPDF_LIBRARY_CONFIG_ { typedef struct FPDF_LIBRARY_CONFIG_ {
@ -188,8 +216,8 @@ typedef struct FPDF_LIBRARY_CONFIG_ {
// Comments: // Comments:
// You have to call this function before you can call any PDF // You have to call this function before you can call any PDF
// processing functions. // processing functions.
DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( FPDF_EXPORT void FPDF_CALLCONV
const FPDF_LIBRARY_CONFIG* config); FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config);
// Function: FPDF_DestroyLibary // Function: FPDF_DestroyLibary
// Release all resources allocated by the FPDFSDK library. // Release all resources allocated by the FPDFSDK library.
@ -202,7 +230,7 @@ DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig(
// the library. // the library.
// After this function is called, you should not call any PDF // After this function is called, you should not call any PDF
// processing functions. // processing functions.
DLLEXPORT void STDCALL FPDF_DestroyLibrary(); FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary();
// Policy for accessing the local machine time. // Policy for accessing the local machine time.
#define FPDF_POLICY_MACHINETIME_ACCESS 0 #define FPDF_POLICY_MACHINETIME_ACCESS 0
@ -215,7 +243,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary();
// enable - True to enable, false to disable the policy. // enable - True to enable, false to disable the policy.
// Return value: // Return value:
// None. // None.
DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_EXPORT void FPDF_CALLCONV FPDF_SetSandBoxPolicy(FPDF_DWORD policy,
FPDF_BOOL enable); FPDF_BOOL enable);
#if defined(_WIN32) #if defined(_WIN32)
@ -234,7 +262,7 @@ typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font,
// func - A function pointer. See description above. // func - A function pointer. See description above.
// Return value: // Return value:
// None. // None.
DLLEXPORT void STDCALL FPDF_EXPORT void FPDF_CALLCONV
FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func); FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func);
// Function: FPDF_SetPrintTextWithGDI // Function: FPDF_SetPrintTextWithGDI
@ -244,20 +272,27 @@ FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func);
// use_gdi - Set to true to enable printing text with GDI. // use_gdi - Set to true to enable printing text with GDI.
// Return value: // Return value:
// None. // 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 #endif // PDFIUM_PRINT_TEXT_WITH_GDI
// Function: FPDF_SetPrintPostscriptLevel // Function: FPDF_SetPrintMode
// Set postscript printing level when printing on Windows. // Set printing mode when printing on Windows.
// Experimental API. // Experimental API.
// Parameters: // Parameters:
// postscript_level - 0 to disable postscript printing, // mode - FPDF_PRINTMODE_EMF to output EMF (default)
// 2 to print with postscript level 2, // FPDF_PRINTMODE_TEXTONLY to output text only (for charstream
// 3 to print with postscript level 3. // devices)
// All other values are invalid. // 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: // Return value:
// True if successful, false if unsucessful (typically invalid input). // True if successful, false if unsuccessful (typically invalid input).
DLLEXPORT FPDF_BOOL STDCALL FPDF_SetPrintPostscriptLevel(FPDF_BOOL use_gdi); FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SetPrintMode(int mode);
#endif // defined(_WIN32) #endif // defined(_WIN32)
// Function: FPDF_LoadDocument // 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). // file_path - Path to the PDF file (including extension).
// password - A string used as the password for the PDF file. // password - A string used as the password for the PDF file.
// If no password is needed, empty or NULL can be used. // If no password is needed, empty or NULL can be used.
// See comments below regarding the encoding.
// Return value: // Return value:
// A handle to the loaded document, or NULL on failure. // A handle to the loaded document, or NULL on failure.
// Comments: // Comments:
// Loaded document can be closed by FPDF_CloseDocument(). // Loaded document can be closed by FPDF_CloseDocument().
// If this function fails, you can use FPDF_GetLastError() to retrieve // If this function fails, you can use FPDF_GetLastError() to retrieve
// the reason why it failed. // 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 // Function: FPDF_LoadMemDocument
// Open and load a PDF document from memory. // 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. // The loaded document can be closed by FPDF_CloseDocument.
// If this function fails, you can use FPDF_GetLastError() to retrieve // If this function fails, you can use FPDF_GetLastError() to retrieve
// the reason why it failed. // the reason why it failed.
//
// See the comments for FPDF_LoadDocument() regarding the encoding for
// |password|.
// Notes: // Notes:
// If PDFium is built with the XFA module, the application should call // If PDFium is built with the XFA module, the application should call
// FPDF_LoadXFA() function after the PDF document loaded to support XFA // FPDF_LoadXFA() function after the PDF document loaded to support XFA
// fields defined in the fpdfformfill.h file. // fields defined in the fpdfformfill.h file.
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
int size, FPDF_LoadMemDocument(const void* data_buf, int size, FPDF_BYTESTRING password);
FPDF_BYTESTRING password);
// Structure for custom file access. // Structure for custom file access.
typedef struct { typedef struct {
@ -304,6 +348,7 @@ typedef struct {
// A function pointer for getting a block of data from a specific position. // 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. // 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. // 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 // It may be possible for FPDFSDK to call this function multiple times for
// the same position. // the same position.
@ -403,7 +448,8 @@ typedef struct _FPDF_FILEHANDLER {
FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size); FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size);
} FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER; } FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER;
#endif #endif // PDF_ENABLE_XFA
// Function: FPDF_LoadCustomDocument // Function: FPDF_LoadCustomDocument
// Load PDF document from a custom access descriptor. // Load PDF document from a custom access descriptor.
// Parameters: // Parameters:
@ -412,15 +458,19 @@ typedef struct _FPDF_FILEHANDLER {
// Return value: // Return value:
// A handle to the loaded document, or NULL on failure. // A handle to the loaded document, or NULL on failure.
// Comments: // Comments:
// The application must keep the file resources valid until the PDF // The application must keep the file resources |pFileAccess| points to
// document is closed. // 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: // Notes:
// If PDFium is built with the XFA module, the application should call // If PDFium is built with the XFA module, the application should call
// FPDF_LoadXFA() function after the PDF document loaded to support XFA // FPDF_LoadXFA() function after the PDF document loaded to support XFA
// fields defined in the fpdfformfill.h file. // 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); FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password);
// Function: FPDF_GetFileVersion // Function: FPDF_GetFileVersion
@ -434,7 +484,7 @@ FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password);
// Comments: // Comments:
// If the document was created by FPDF_CreateNewDocument, // If the document was created by FPDF_CreateNewDocument,
// then this function will always fail. // then this function will always fail.
DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetFileVersion(FPDF_DOCUMENT doc,
int* fileVersion); int* fileVersion);
#define FPDF_ERR_SUCCESS 0 // No error. #define FPDF_ERR_SUCCESS 0 // No error.
@ -458,7 +508,22 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc,
// Comments: // Comments:
// If the previous SDK call succeeded, the return value of this // If the previous SDK call succeeded, the return value of this
// function is not defined. // 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 // Function: FPDF_GetDocPermission
// Get file permission flags of the document. // 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 // A 32-bit integer indicating permission flags. Please refer to the
// PDF Reference for detailed descriptions. If the document is not // PDF Reference for detailed descriptions. If the document is not
// protected, 0xffffffff will be returned. // 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 // Function: FPDF_GetSecurityHandlerRevision
// Get the revision for the security handler. // 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 // The security handler revision number. Please refer to the PDF
// Reference for a detailed description. If the document is not // Reference for a detailed description. If the document is not
// protected, -1 will be returned. // 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 // Function: FPDF_GetPageCount
// Get total number of pages in the document. // 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. // document - Handle to document. Returned by FPDF_LoadDocument.
// Return value: // Return value:
// Total number of pages in the document. // 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 // Function: FPDF_LoadPage
// Load a page inside the document. // Load a page inside the document.
@ -498,7 +565,7 @@ DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document);
// Comments: // Comments:
// The loaded page can be rendered to devices using FPDF_RenderPage. // The loaded page can be rendered to devices using FPDF_RenderPage.
// The loaded page can be closed using FPDF_ClosePage. // The loaded page can be closed using FPDF_ClosePage.
DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document,
int page_index); int page_index);
// Function: FPDF_GetPageWidth // Function: FPDF_GetPageWidth
@ -508,7 +575,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
// Return value: // Return value:
// Page width (excluding non-displayable area) measured in points. // Page width (excluding non-displayable area) measured in points.
// One point is 1/72 inch (around 0.3528 mm). // 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 // Function: FPDF_GetPageHeight
// Get page height. // Get page height.
@ -517,7 +584,20 @@ DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page);
// Return value: // Return value:
// Page height (excluding non-displayable area) measured in points. // Page height (excluding non-displayable area) measured in points.
// One point is 1/72 inch (around 0.3528 mm) // 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 // Function: FPDF_GetPageSizeByIndex
// Get the size of the page at the given index. // Get the size of the page at the given index.
@ -530,7 +610,7 @@ DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page);
// (in points). // (in points).
// Return value: // Return value:
// Non-zero for success. 0 for error (document or page not found). // Non-zero for success. 0 for error (document or page not found).
DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
int page_index, int page_index,
double* width, double* width,
double* height); double* height);
@ -587,7 +667,7 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
// defined above. // defined above.
// Return value: // Return value:
// None. // None.
DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage(HDC dc,
FPDF_PAGE page, FPDF_PAGE page,
int start_x, int start_x,
int start_y, int start_y,
@ -602,7 +682,8 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
// Parameters: // Parameters:
// bitmap - Handle to the device independent bitmap (as the // bitmap - Handle to the device independent bitmap (as the
// output buffer). The bitmap handle can be created // 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 // page - Handle to the page. Returned by FPDF_LoadPage
// start_x - Left pixel position of the display area in // start_x - Left pixel position of the display area in
// bitmap coordinates. // bitmap coordinates.
@ -622,7 +703,7 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
// widget and popup annotations. // widget and popup annotations.
// Return value: // Return value:
// None. // None.
DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
FPDF_PAGE page, FPDF_PAGE page,
int start_x, int start_x,
int start_y, int start_y,
@ -636,25 +717,28 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
// Parameters: // Parameters:
// bitmap - Handle to the device independent bitmap (as the // bitmap - Handle to the device independent bitmap (as the
// output buffer). The bitmap handle can be created // output buffer). The bitmap handle can be created
// by FPDFBitmap_Create. // by FPDFBitmap_Create or retrieved by
// page - Handle to the page. Returned by FPDF_LoadPage // FPDFImageObj_GetBitmap.
// matrix - The transform matrix. // page - Handle to the page. Returned by FPDF_LoadPage.
// clipping - The rect to clip to. // 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 // flags - 0 for normal display, or combination of the Page
// Rendering flags defined above. With the FPDF_ANNOT // Rendering flags defined above. With the FPDF_ANNOT
// flag, it renders all annotations that do not require // flag, it renders all annotations that do not require
// user-interaction, which are all annotations except // user-interaction, which are all annotations except
// widget and popup annotations. // widget and popup annotations.
// Return value: // Return value:
// None. // None. Note that behavior is undefined if det of |matrix| is 0.
DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, FPDF_EXPORT void FPDF_CALLCONV
FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap,
FPDF_PAGE page, FPDF_PAGE page,
const FS_MATRIX* matrix, const FS_MATRIX* matrix,
const FS_RECTF* clipping, const FS_RECTF* clipping,
int flags); int flags);
#ifdef _SKIA_SUPPORT_ #ifdef _SKIA_SUPPORT_
DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page, FPDF_EXPORT FPDF_RECORDER FPDF_CALLCONV FPDF_RenderPageSkp(FPDF_PAGE page,
int size_x, int size_x,
int size_y); int size_y);
#endif #endif
@ -665,7 +749,7 @@ DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page,
// page - Handle to the loaded page. // page - Handle to the loaded page.
// Return value: // Return value:
// None. // None.
DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page);
// Function: FPDF_CloseDocument // Function: FPDF_CloseDocument
// Close a loaded PDF document. // Close a loaded PDF document.
@ -673,7 +757,7 @@ DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);
// document - Handle to the loaded document. // document - Handle to the loaded document.
// Return value: // Return value:
// None. // None.
DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseDocument(FPDF_DOCUMENT document);
// Function: FPDF_DeviceToPage // Function: FPDF_DeviceToPage
// Convert the screen coordinates of a point to page coordinates. // 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 // page_y - A pointer to a double receiving the converted Y
// value in page coordinates. // value in page coordinates.
// Return value: // Return value:
// None. // Returns true if the conversion succeeds, and |page_x| and |page_y|
// successfully receives the converted coordinates.
// Comments: // Comments:
// The page coordinate system has its origin at the left-bottom corner // 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 // of the page, with the X-axis on the bottom going to the right, and
@ -715,7 +800,7 @@ DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
// You must make sure the start_x, start_y, size_x, size_y // You must make sure the start_x, start_y, size_x, size_y
// and rotate parameters have exactly same values as you used in // and rotate parameters have exactly same values as you used in
// the FPDF_RenderPage() function call. // the FPDF_RenderPage() function call.
DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_DeviceToPage(FPDF_PAGE page,
int start_x, int start_x,
int start_y, int start_y,
int size_x, int size_x,
@ -748,10 +833,11 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page,
// device_y - A pointer to an integer receiving the result Y // device_y - A pointer to an integer receiving the result Y
// value in device coordinates. // value in device coordinates.
// Return value: // Return value:
// None. // Returns true if the conversion succeeds, and |device_x| and
// |device_y| successfully receives the converted coordinates.
// Comments: // Comments:
// See comments for FPDF_DeviceToPage(). // See comments for FPDF_DeviceToPage().
DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_PageToDevice(FPDF_PAGE page,
int start_x, int start_x,
int start_y, int start_y,
int size_x, int size_x,
@ -791,11 +877,13 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
// This function allocates enough memory for holding all pixels in the // This function allocates enough memory for holding all pixels in the
// bitmap, but it doesn't initialize the buffer. Applications can use // bitmap, but it doesn't initialize the buffer. Applications can use
// FPDFBitmap_FillRect to fill the bitmap using any color. // FPDFBitmap_FillRect to fill the bitmap using any color.
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_Create(int width,
int height, int height,
int alpha); int alpha);
// More DIB formats // More DIB formats
// Unknown or unsupported format.
#define FPDFBitmap_Unknown 0
// Gray scale bitmap, one byte per pixel. // Gray scale bitmap, one byte per pixel.
#define FPDFBitmap_Gray 1 #define FPDFBitmap_Gray 1
// 3 bytes per pixel, byte order: blue, green, red. // 3 bytes per pixel, byte order: blue, green, red.
@ -830,12 +918,24 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width,
// If an external buffer is used, then the application should destroy // If an external buffer is used, then the application should destroy
// the buffer by itself. FPDFBitmap_Destroy function will not destroy // the buffer by itself. FPDFBitmap_Destroy function will not destroy
// the buffer. // the buffer.
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_CreateEx(int width,
int height, int height,
int format, int format,
void* first_scan, void* first_scan,
int stride); 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 // Function: FPDFBitmap_FillRect
// Fill a rectangle in a bitmap. // Fill a rectangle in a bitmap.
// Parameters: // Parameters:
@ -860,7 +960,7 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width,
// background will be replaced by the source color and the alpha. // background will be replaced by the source color and the alpha.
// //
// If the alpha channel is not used, the alpha parameter is ignored. // If the alpha channel is not used, the alpha parameter is ignored.
DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, FPDF_EXPORT void FPDF_CALLCONV FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
int left, int left,
int top, int top,
int width, int width,
@ -870,7 +970,8 @@ DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
// Function: FPDFBitmap_GetBuffer // Function: FPDFBitmap_GetBuffer
// Get data buffer of a bitmap. // Get data buffer of a bitmap.
// Parameters: // Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value: // Return value:
// The pointer to the first byte of the bitmap buffer. // The pointer to the first byte of the bitmap buffer.
// Comments: // 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 // The data is in BGRA format. Where the A maybe unused if alpha was
// not specified. // not specified.
DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); FPDF_EXPORT void* FPDF_CALLCONV FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_GetWidth // Function: FPDFBitmap_GetWidth
// Get width of a bitmap. // Get width of a bitmap.
// Parameters: // Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value: // Return value:
// The width of the bitmap in pixels. // 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 // Function: FPDFBitmap_GetHeight
// Get height of a bitmap. // Get height of a bitmap.
// Parameters: // Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value: // Return value:
// The height of the bitmap in pixels. // 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 // Function: FPDFBitmap_GetStride
// Get number of bytes for each line in the bitmap buffer. // Get number of bytes for each line in the bitmap buffer.
// Parameters: // Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value: // Return value:
// The number of bytes for each line in the bitmap buffer. // The number of bytes for each line in the bitmap buffer.
// Comments: // Comments:
// The stride may be more than width * number of bytes per pixel. // 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 // Function: FPDFBitmap_Destroy
// Destroy a bitmap and release all related buffers. // Destroy a bitmap and release all related buffers.
// Parameters: // Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. // bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value: // Return value:
// None. // None.
// Comments: // Comments:
// This function will not destroy any external buffers provided when // This function will not destroy any external buffers provided when
// the bitmap was created. // 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 // Function: FPDF_VIEWERREF_GetPrintScaling
// Whether the PDF document prefers to be scaled or not. // 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. // document - Handle to the loaded document.
// Return value: // Return value:
// None. // None.
DLLEXPORT FPDF_BOOL STDCALL FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
// Function: FPDF_VIEWERREF_GetNumCopies // Function: FPDF_VIEWERREF_GetNumCopies
@ -936,7 +1041,8 @@ FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
// document - Handle to the loaded document. // document - Handle to the loaded document.
// Return value: // Return value:
// The number of copies to be printed. // 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 // Function: FPDF_VIEWERREF_GetPrintPageRange
// Page numbers to initialize print dialog box when file is printed. // 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. // document - Handle to the loaded document.
// Return value: // Return value:
// The print page range to be used for printing. // 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); 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 // Function: FPDF_VIEWERREF_GetDuplex
// Returns the paper handling option to be used when printing from // Returns the paper handling option to be used when printing from
// the print dialog. // the print dialog.
@ -954,7 +1082,7 @@ FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document);
// document - Handle to the loaded document. // document - Handle to the loaded document.
// Return value: // Return value:
// The paper handling option to be used when printing. // 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); FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
// Function: FPDF_VIEWERREF_GetName // Function: FPDF_VIEWERREF_GetName
@ -962,7 +1090,8 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
// be of type "name". // be of type "name".
// Parameters: // Parameters:
// document - Handle to the loaded document. // 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. // buffer - A string to write the contents of the key to.
// length - Length of the buffer. // length - Length of the buffer.
// Return value: // Return value:
@ -971,7 +1100,8 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
// as when |document| is invalid or |buffer| is NULL. If |length| is // as when |document| is invalid or |buffer| is NULL. If |length| is
// less than the returned length, or |buffer| is NULL, |buffer| will // less than the returned length, or |buffer| is NULL, |buffer| will
// not be modified. // not be modified.
DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document, FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document,
FPDF_BYTESTRING key, FPDF_BYTESTRING key,
char* buffer, char* buffer,
unsigned long length); unsigned long length);
@ -982,7 +1112,8 @@ DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document,
// document - Handle to a document // document - Handle to a document
// Return value: // Return value:
// The count of named destinations. // 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 // Function: FPDF_GetNamedDestByName
// Get a the destination handle for the given name. // 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. // name - The name of a destination.
// Return value: // Return value:
// The handle to the destination. // The handle to the destination.
DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, FPDF_EXPORT FPDF_DEST FPDF_CALLCONV
FPDF_BYTESTRING name); FPDF_GetNamedDestByName(FPDF_DOCUMENT document, FPDF_BYTESTRING name);
// Function: FPDF_GetNamedDest // Function: FPDF_GetNamedDest
// Get the named destination by index. // 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 // If buflen is not sufficiently large, it will be set to -1 upon
// return. // return.
DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document,
int index, int index,
void* buffer, void* buffer,
long* buflen); 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 #ifdef PDF_ENABLE_XFA
// Function: FPDF_BStr_Init // Function: FPDF_BStr_Init
// Helper function to initialize a byte string. // 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 // Function: FPDF_BStr_Set
// Helper function to set string data. // Helper function to set string data.
DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Set(FPDF_BSTR* str,
FPDF_LPCSTR bstr, FPDF_LPCSTR bstr,
int length); int length);
// Function: FPDF_BStr_Clear // Function: FPDF_BStr_Clear
// Helper function to clear a byte string. // 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 #endif // PDF_ENABLE_XFA
#ifdef __cplusplus #ifdef __cplusplus

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.