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

View File

@ -25,6 +25,17 @@ extern "C" {
// Launch an application or open a file.
#define PDFACTION_LAUNCH 4
// View destination fit types. See pdfmark reference v9, page 48.
#define PDFDEST_VIEW_UNKNOWN_MODE 0
#define PDFDEST_VIEW_XYZ 1
#define PDFDEST_VIEW_FIT 2
#define PDFDEST_VIEW_FITH 3
#define PDFDEST_VIEW_FITV 4
#define PDFDEST_VIEW_FITR 5
#define PDFDEST_VIEW_FITB 6
#define PDFDEST_VIEW_FITBH 7
#define PDFDEST_VIEW_FITBV 8
typedef struct _FS_QUADPOINTSF {
FS_FLOAT x1;
FS_FLOAT y1;
@ -44,7 +55,7 @@ typedef struct _FS_QUADPOINTSF {
//
// Returns a handle to the first child of |bookmark| or the first top-level
// bookmark item. NULL if no child or top-level bookmark found.
DLLEXPORT FPDF_BOOKMARK STDCALL
FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// Get the next sibling of |bookmark|.
@ -54,7 +65,7 @@ FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
//
// Returns a handle to the next sibling of |bookmark|, or NULL if this is the
// last bookmark at this level.
DLLEXPORT FPDF_BOOKMARK STDCALL
FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// Get the title of |bookmark|.
@ -70,9 +81,10 @@ FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The
// string is terminated by a UTF16 NUL character. If |buflen| is less than the
// required length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark,
void* buffer,
unsigned long buflen);
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark,
void* buffer,
unsigned long buflen);
// Find the bookmark with |title| in |document|.
//
@ -81,10 +93,10 @@ DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark,
//
// Returns the handle to the bookmark, or NULL if |title| can't be found.
//
// |FPDFBookmark_Find| will always return the first bookmark found even if
// FPDFBookmark_Find() will always return the first bookmark found even if
// multiple bookmarks have the same |title|.
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document,
FPDF_WIDESTRING title);
FPDF_EXPORT FPDF_BOOKMARK FPDF_CALLCONV
FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title);
// Get the destination associated with |bookmark|.
//
@ -93,17 +105,18 @@ DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document,
//
// Returns the handle to the destination data, NULL if no destination is
// associated with |bookmark|.
DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document,
FPDF_BOOKMARK bookmark);
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV
FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// Get the action associated with |bookmark|.
//
// bookmark - handle to the bookmark.
//
// Returns the handle to the action data, or NULL if no action is associated
// with |bookmark|. When NULL is returned, |FPDFBookmark_GetDest| should be
// with |bookmark|. When NULL is returned, FPDFBookmark_GetDest() should be
// called to get the |bookmark| destination data.
DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV
FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
// Get the type of |action|.
//
@ -115,7 +128,7 @@ DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
// PDFACTION_REMOTEGOTO
// PDFACTION_URI
// PDFACTION_LAUNCH
DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action);
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDFAction_GetType(FPDF_ACTION action);
// Get the destination of |action|.
//
@ -123,54 +136,71 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action);
// action - handle to the action. |action| must be a |PDFACTION_GOTO| or
// |PDFACTION_REMOTEGOTO|.
//
// Returns a handle to the destination data.
// Returns a handle to the destination data, or NULL on error, typically
// because the arguments were bad or the action was of the wrong type.
//
// In the case of |PDFACTION_REMOTEGOTO|, you should first call
// |FPDFAction_GetFilePath| then load that document, the document handle from
// that document should pass as |document| to |FPDFAction_GetDest|.
DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document,
FPDF_ACTION action);
// In the case of |PDFACTION_REMOTEGOTO|, you must first call
// FPDFAction_GetFilePath(), then load the document at that path, then pass
// the document handle from that document as |document| to FPDFAction_GetDest().
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFAction_GetDest(FPDF_DOCUMENT document,
FPDF_ACTION action);
// Get file path of a |PDFACTION_REMOTEGOTO| |action|.
// Get the file path of |action|.
//
// action - handle to the action. |action| must be a |PDFACTION_LAUNCH| or
// |PDFACTION_REMOTEGOTO|
// |PDFACTION_REMOTEGOTO|.
// buffer - a buffer for output the path string. May be NULL.
// buflen - the length of the buffer, in bytes. May be 0.
//
// Returns the number of bytes in the file path, including the trailing UTF16
// NUL character.
// Returns the number of bytes in the file path, including the trailing NUL
// character, or 0 on error, typically because the arguments were bad or the
// action was of the wrong type.
//
// Regardless of the platform, the |buffer| is always in UTF-16LE encoding.
// Regardless of the platform, the |buffer| is always in UTF-8 encoding.
// If |buflen| is less than the returned length, or |buffer| is NULL, |buffer|
// will not be modified.
DLLEXPORT unsigned long STDCALL
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen);
// Get the URI path of a |PDFACTION_URI| |action|.
// Get the URI path of |action|.
//
// document - handle to the document.
// action - handle to the action. Must be a |PDFACTION_URI|.
// buffer - a buffer for the path string. May be NULL.
// buflen - the length of the buffer, in bytes. May be 0.
//
// Returns the number of bytes in the URI path, including trailing zeros.
// Returns the number of bytes in the URI path, including the trailing NUL
// character, or 0 on error, typically because the arguments were bad or the
// action was of the wrong type.
//
// The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less than the
// returned length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document,
FPDF_ACTION action,
void* buffer,
unsigned long buflen);
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDFAction_GetURIPath(FPDF_DOCUMENT document,
FPDF_ACTION action,
void* buffer,
unsigned long buflen);
// Get the page index of |dest|.
//
// document - handle to the document.
// dest - handle to the destination.
//
// Returns the page index containing |dest|. Page indices start from 0.
DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document,
FPDF_DEST dest);
// Returns the 0-based page index containing |dest|. Returns -1 on error.
FPDF_EXPORT int FPDF_CALLCONV FPDFDest_GetDestPageIndex(FPDF_DOCUMENT document,
FPDF_DEST dest);
// Get the view (fit type) specified by |dest|.
// Experimental API. Subject to change.
//
// dest - handle to the destination.
// pNumParams - receives the number of view parameters, which is at most 4.
// pParams - buffer to write the view parameters. Must be at least 4
// FS_FLOATs long.
// Returns one of the PDFDEST_VIEW_* constants, PDFDEST_VIEW_UNKNOWN_MODE if
// |dest| does not specify a view.
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDFDest_GetView(FPDF_DEST dest, unsigned long* pNumParams, FS_FLOAT* pParams);
// Get the (x, y, zoom) location of |dest| in the destination page, if the
// destination is in [page /XYZ x y zoom] syntax.
@ -186,13 +216,14 @@ DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document,
//
// Note the [x, y, zoom] values are only set if the corresponding hasXVal,
// hasYVal or hasZoomVal flags are true.
DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST dest,
FPDF_BOOL* hasXCoord,
FPDF_BOOL* hasYCoord,
FPDF_BOOL* hasZoom,
FS_FLOAT* x,
FS_FLOAT* y,
FS_FLOAT* zoom);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFDest_GetLocationInPage(FPDF_DEST dest,
FPDF_BOOL* hasXCoord,
FPDF_BOOL* hasYCoord,
FPDF_BOOL* hasZoom,
FS_FLOAT* x,
FS_FLOAT* y,
FS_FLOAT* zoom);
// Find a link at point (|x|,|y|) on |page|.
//
@ -203,10 +234,10 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST dest,
// Returns a handle to the link, or NULL if no link found at the given point.
//
// You can convert coordinates from screen coordinates to page coordinates using
// |FPDF_DeviceToPage|.
DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
double x,
double y);
// FPDF_DeviceToPage().
FPDF_EXPORT FPDF_LINK FPDF_CALLCONV FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
double x,
double y);
// Find the Z-order of link at point (|x|,|y|) on |page|.
//
@ -218,9 +249,10 @@ DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
// Larger Z-order numbers are closer to the front.
//
// You can convert coordinates from screen coordinates to page coordinates using
// |FPDF_DeviceToPage|.
DLLEXPORT int STDCALL
FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y);
// FPDF_DeviceToPage().
FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page,
double x,
double y);
// Get destination info for |link|.
//
@ -228,56 +260,57 @@ FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y);
// link - handle to the link.
//
// Returns a handle to the destination, or NULL if there is no destination
// associated with the link. In this case, you should call |FPDFLink_GetAction|
// associated with the link. In this case, you should call FPDFLink_GetAction()
// to retrieve the action associated with |link|.
DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document,
FPDF_LINK link);
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDFLink_GetDest(FPDF_DOCUMENT document,
FPDF_LINK link);
// Get action info for |link|.
//
// link - handle to the link.
//
// Returns a handle to the action associated to |link|, or NULL if no action.
DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link);
FPDF_EXPORT FPDF_ACTION FPDF_CALLCONV FPDFLink_GetAction(FPDF_LINK link);
// Enumerates all the link annotations in |page|.
//
// page - handle to the page.
// startPos - the start position, should initially be 0 and is updated with
// the next start position on return.
// linkAnnot - the link handle for |startPos|.
// page - handle to the page.
// start_pos - the start position, should initially be 0 and is updated with
// the next start position on return.
// link_annot - the link handle for |startPos|.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page,
int* startPos,
FPDF_LINK* linkAnnot);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page,
int* start_pos,
FPDF_LINK* link_annot);
// Get the rectangle for |linkAnnot|.
// Get the rectangle for |link_annot|.
//
// linkAnnot - handle to the link annotation.
// rect - the annotation rectangle.
// link_annot - handle to the link annotation.
// rect - the annotation rectangle.
//
// Returns true on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot,
FS_RECTF* rect);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetAnnotRect(FPDF_LINK link_annot,
FS_RECTF* rect);
// Get the count of quadrilateral points to the |linkAnnot|.
// Get the count of quadrilateral points to the |link_annot|.
//
// linkAnnot - handle to the link annotation.
// link_annot - handle to the link annotation.
//
// Returns the count of quadrilateral points.
DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot);
FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountQuadPoints(FPDF_LINK link_annot);
// Get the quadrilateral points for the specified |quadIndex| in |linkAnnot|.
// Get the quadrilateral points for the specified |quad_index| in |link_annot|.
//
// linkAnnot - handle to the link annotation.
// quadIndex - the specified quad point index.
// quadPoints - receives the quadrilateral points.
// link_annot - handle to the link annotation.
// quad_index - the specified quad point index.
// quad_points - receives the quadrilateral points.
//
// Returns true on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
int quadIndex,
FS_QUADPOINTSF* quadPoints);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFLink_GetQuadPoints(FPDF_LINK link_annot,
int quad_index,
FS_QUADPOINTSF* quad_points);
// Get meta-data |tag| content from |document|.
//
@ -296,10 +329,14 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two
// bytes of zeros indicating the end of the string. If |buflen| is less than
// the returned length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document,
FPDF_BYTESTRING tag,
void* buffer,
unsigned long buflen);
//
// For linearized files, FPDFAvail_IsFormAvail must be called before this, and
// it must have returned PDF_FORM_AVAIL or PDF_FORM_NOTEXIST. Before that, there
// is no guarantee the metadata has been loaded.
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document,
FPDF_BYTESTRING tag,
void* buffer,
unsigned long buflen);
// Get the page label for |page_index| from |document|.
//
@ -313,10 +350,11 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document,
// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two
// bytes of zeros indicating the end of the string. If |buflen| is less than
// the returned length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDF_GetPageLabel(FPDF_DOCUMENT document,
int page_index,
void* buffer,
unsigned long buflen);
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_GetPageLabel(FPDF_DOCUMENT document,
int page_index,
void* buffer,
unsigned long buflen);
#ifdef __cplusplus
} // extern "C"

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,8 @@
#ifndef PUBLIC_FPDF_EXT_H_
#define PUBLIC_FPDF_EXT_H_
#include <time.h>
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
@ -64,9 +66,28 @@ typedef struct _UNSUPPORT_INFO {
// unsp_info - Pointer to an UNSUPPORT_INFO structure.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);
// Set replacement function for calls to time().
//
// This API is intended to be used only for testing, thus may cause PDFium to
// behave poorly in production environments.
//
// func - Function pointer to alternate implementation of time(), or
// NULL to restore to actual time() call itself.
FPDF_EXPORT void FPDF_CALLCONV FSDK_SetTimeFunction(time_t (*func)());
// Set replacement function for calls to localtime().
//
// This API is intended to be used only for testing, thus may cause PDFium to
// behave poorly in production environments.
//
// func - Function pointer to alternate implementation of localtime(), or
// NULL to restore to actual localtime() call itself.
FPDF_EXPORT void FPDF_CALLCONV
FSDK_SetLocaltimeFunction(struct tm* (*func)(const time_t*));
// Unknown page mode.
#define PAGEMODE_UNKNOWN -1
// Document outline, and thumbnails hidden.
@ -89,7 +110,7 @@ FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);
// Returns one of the |PAGEMODE_*| flags defined above.
//
// The page mode defines how the document should be initially displayed.
DLLEXPORT int STDCALL FPDFDoc_GetPageMode(FPDF_DOCUMENT document);
FPDF_EXPORT int FPDF_CALLCONV FPDFDoc_GetPageMode(FPDF_DOCUMENT document);
#ifdef __cplusplus
} // extern "C"

View File

@ -35,7 +35,7 @@ extern "C" {
//
// Currently, all failures return |FLATTEN_FAIL| with no indication of the
// cause.
DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag);
FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag);
#ifdef __cplusplus
} // extern "C"

File diff suppressed because it is too large Load Diff

View File

@ -23,10 +23,34 @@ extern "C" {
// index - The page index to insert at.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc,
FPDF_BYTESTRING pagerange,
int index);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc,
FPDF_BYTESTRING pagerange,
int index);
// Experimental API.
// Create a new document from |src_doc|. The pages of |src_doc| will be
// combined to provide |num_pages_on_x_axis x num_pages_on_y_axis| pages per
// |output_doc| page.
//
// src_doc - The document to be imported.
// output_width - The output page width in PDF "user space" units.
// output_height - The output page height in PDF "user space" units.
// num_pages_on_x_axis - The number of pages on X Axis.
// num_pages_on_y_axis - The number of pages on Y Axis.
//
// Return value:
// A handle to the created document, or NULL on failure.
//
// Comments:
// number of pages per page = num_pages_on_x_axis * num_pages_on_y_axis
//
FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
FPDF_ImportNPagesToOne(FPDF_DOCUMENT src_doc,
float output_width,
float output_height,
unsigned int num_pages_on_x_axis,
unsigned int num_pages_on_y_axis);
// Copy the viewer preferences from |src_doc| into |dest_doc|.
//
@ -34,8 +58,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
// src_doc - Document to read the viewer preferences from.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc, FPDF_DOCUMENT src_doc);
#ifdef __cplusplus
} // extern "C"

View File

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

View File

@ -59,9 +59,9 @@ typedef struct FPDF_FILEWRITE_ {
// Return value:
// TRUE for succeed, FALSE for failed.
//
DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document,
FPDF_FILEWRITE* pFileWrite,
FPDF_DWORD flags);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SaveAsCopy(FPDF_DOCUMENT document,
FPDF_FILEWRITE* pFileWrite,
FPDF_DWORD flags);
// Function: FPDF_SaveWithVersion
// Same as function ::FPDF_SaveAsCopy, except the file version of the
@ -75,10 +75,11 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document,
// Return value:
// TRUE if succeed, FALSE if failed.
//
DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,
FPDF_FILEWRITE* pFileWrite,
FPDF_DWORD flags,
int fileVersion);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDF_SaveWithVersion(FPDF_DOCUMENT document,
FPDF_FILEWRITE* pFileWrite,
FPDF_DWORD flags,
int fileVersion);
#ifdef __cplusplus
}

View File

@ -17,12 +17,21 @@ extern "C" {
// Get the character index in |text_page| internal character list.
//
// text_page - a text page information structure.
// nTextIndex - index of the text returned from |FPDFText_GetText|.
// nTextIndex - index of the text returned from FPDFText_GetText().
//
// Returns the index of the character in internal character list. -1 for error.
DLLEXPORT int STDCALL
FPDF_EXPORT int FPDF_CALLCONV
FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex);
// Get the text index in |text_page| internal character list.
//
// text_page - a text page information structure.
// nCharIndex - index of the character in internal character list.
//
// Returns the index of the text returned from FPDFText_GetText(). -1 for error.
FPDF_EXPORT int FPDF_CALLCONV
FPDFText_GetTextIndexFromCharIndex(FPDF_TEXTPAGE text_page, int nCharIndex);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -21,7 +21,8 @@ extern "C" {
// function.
// Return value:
// A handle to the structure tree or NULL on error.
DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page);
FPDF_EXPORT FPDF_STRUCTTREE FPDF_CALLCONV
FPDF_StructTree_GetForPage(FPDF_PAGE page);
// Function: FPDF_StructTree_Close
// Release the resource allocate by FPDF_StructTree_GetForPage.
@ -30,7 +31,8 @@ DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page);
// FPDF_StructTree_LoadPage function.
// Return value:
// NULL
DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree);
FPDF_EXPORT void FPDF_CALLCONV
FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree);
// Function: FPDF_StructTree_CountChildren
// Count the number of children for the structure tree.
@ -39,7 +41,7 @@ DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree);
// FPDF_StructTree_LoadPage function.
// Return value:
// The number of children, or -1 on error.
DLLEXPORT int STDCALL
FPDF_EXPORT int FPDF_CALLCONV
FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree);
// Function: FPDF_StructTree_GetChildAtIndex
@ -50,7 +52,7 @@ FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree);
// index - The index for the child, 0-based.
// Return value:
// The child at the n-th index or NULL on error.
DLLEXPORT FPDF_STRUCTELEMENT STDCALL
FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV
FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index);
// Function: FPDF_StructElement_GetAltText
@ -68,18 +70,68 @@ FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index);
// encoding. The string is terminated by a UTF16 NUL character. If
// |buflen| is less than the required length, or |buffer| is NULL,
// |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element,
void* buffer,
unsigned long buflen);
// Function: FPDF_StructElement_GetMarkedContentID
// Get the marked content ID for a given element.
// Parameters:
// struct_element - Handle to the struct element.
// Return value:
// The marked content ID of the element. If no ID exists, returns
// -1.
FPDF_EXPORT int FPDF_CALLCONV
FPDF_StructElement_GetMarkedContentID(FPDF_STRUCTELEMENT struct_element);
// Function: FPDF_StructElement_GetType
// Get the type (/S) for a given element.
// Parameters:
// struct_element - Handle to the struct element.
// buffer - A buffer for output. May be NULL.
// buflen - The length of the buffer, in bytes. May be 0.
// Return value:
// The number of bytes in the type, including the terminating NUL
// character. The number of bytes is returned regardless of the
// |buffer| and |buflen| parameters.
// Comments:
// Regardless of the platform, the |buffer| is always in UTF-16LE
// encoding. The string is terminated by a UTF16 NUL character. If
// |buflen| is less than the required length, or |buffer| is NULL,
// |buffer| will not be modified.
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element,
void* buffer,
unsigned long buflen);
// Function: FPDF_StructElement_GetTitle
// Get the title (/T) for a given element.
// Parameters:
// struct_element - Handle to the struct element.
// buffer - A buffer for output. May be NULL.
// buflen - The length of the buffer, in bytes. May be 0.
// Return value:
// The number of bytes in the title, including the terminating NUL
// character. The number of bytes is returned regardless of the
// |buffer| and |buflen| parameters.
// Comments:
// Regardless of the platform, the |buffer| is always in UTF-16LE
// encoding. The string is terminated by a UTF16 NUL character. If
// |buflen| is less than the required length, or |buffer| is NULL,
// |buffer| will not be modified.
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_StructElement_GetTitle(FPDF_STRUCTELEMENT struct_element,
void* buffer,
unsigned long buflen);
// Function: FPDF_StructElement_CountChildren
// Count the number of children for the structure element.
// Parameters:
// struct_element - Handle to the struct element.
// Return value:
// The number of children, or -1 on error.
DLLEXPORT int STDCALL
FPDF_EXPORT int FPDF_CALLCONV
FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element);
// Function: FPDF_StructElement_GetChildAtIndex
@ -92,12 +144,12 @@ FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element);
// Comments:
// If the child exists but is not an element, then this function will
// return NULL. This will also return NULL for out of bounds indices.
DLLEXPORT FPDF_STRUCTELEMENT STDCALL
FPDF_EXPORT FPDF_STRUCTELEMENT FPDF_CALLCONV
FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
int index);
#ifdef __cplusplus
}
} // extern "C"
#endif
#endif // PUBLIC_FPDF_STRUCTTREE_H_

View File

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

View File

@ -27,7 +27,7 @@ extern "C" {
// Application must call FPDFText_ClosePage to release the text page
// information.
//
DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page);
FPDF_EXPORT FPDF_TEXTPAGE FPDF_CALLCONV FPDFText_LoadPage(FPDF_PAGE page);
// Function: FPDFText_ClosePage
// Release all resources allocated for a text page information
@ -38,7 +38,7 @@ DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page);
// Return Value:
// None.
//
DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
FPDF_EXPORT void FPDF_CALLCONV FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
// Function: FPDFText_CountChars
// Get number of characters in a page.
@ -56,7 +56,7 @@ DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
// first character in the page
// has an index value of zero.
//
DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page);
FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountChars(FPDF_TEXTPAGE text_page);
// Function: FPDFText_GetUnicode
// Get Unicode of a character in a page.
@ -70,8 +70,8 @@ DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page);
// convert to Unicode,
// the return value will be zero.
//
DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page,
int index);
FPDF_EXPORT unsigned int FPDF_CALLCONV
FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int index);
// Function: FPDFText_GetFontSize
// Get the font size of a particular character.
@ -84,8 +84,33 @@ DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page,
// 1/72 inch).
// This is the typographic size of the font (so called "em size").
//
DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
int index);
FPDF_EXPORT double FPDF_CALLCONV FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
int index);
// Experimental API.
// Function: FPDFText_GetFontInfo
// Get the font name and flags of a particular character.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// index - Zero-based index of the character.
// buffer - A buffer receiving the font name.
// buflen - The length of |buffer| in bytes.
// flags - Optional pointer to an int receiving the font flags.
// These flags should be interpreted per PDF spec 1.7 Section 5.7.1
// Font Descriptor Flags.
// Return value:
// On success, return the length of the font name, including the
// trailing NUL character, in bytes. If this length is less than or
// equal to |length|, |buffer| is set to the font name, |flags| is
// set to the font flags. |buffer| is in UTF-8 encoding. Return 0 on
// failure.
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDFText_GetFontInfo(FPDF_TEXTPAGE text_page,
int index,
void* buffer,
unsigned long buflen,
int* flags);
// Function: FPDFText_GetCharBox
// Get bounding box of a particular character.
@ -102,16 +127,39 @@ DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
// top - Pointer to a double number receiving top position of
// the character box.
// Return Value:
// None.
// On success, return TRUE and fill in |left|, |right|, |bottom|, and
// |top|. If |text_page| is invalid, or if |index| is out of bounds,
// then return FALSE, and the out parameters remain unmodified.
// Comments:
// All positions are measured in PDF "user space".
//
DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
int index,
double* left,
double* right,
double* bottom,
double* top);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
int index,
double* left,
double* right,
double* bottom,
double* top);
// Function: FPDFText_GetCharOrigin
// Get origin of a particular character.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// index - Zero-based index of the character.
// x - Pointer to a double number receiving x coordinate of
// the character origin.
// y - Pointer to a double number receiving y coordinate of
// the character origin.
// Return Value:
// Whether the call succeeded. If false, x and y are unchanged.
// Comments:
// All positions are measured in PDF "user space".
//
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDFText_GetCharOrigin(FPDF_TEXTPAGE text_page,
int index,
double* x,
double* y);
// Function: FPDFText_GetCharIndexAtPos
// Get the index of a character at or nearby a certain position on the
@ -131,11 +179,12 @@ DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
// be -1.
// If an error occurs, -3 will be returned.
//
DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
double x,
double y,
double xTolerance,
double yTolerance);
FPDF_EXPORT int FPDF_CALLCONV
FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
double x,
double y,
double xTolerance,
double yTolerance);
// Function: FPDFText_GetText
// Extract unicode text string from the page.
@ -154,10 +203,10 @@ DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
// Comments:
// This function ignores characters without unicode information.
//
DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,
int start_index,
int count,
unsigned short* result);
FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetText(FPDF_TEXTPAGE text_page,
int start_index,
int count,
unsigned short* result);
// Function: FPDFText_CountRects
// Count number of rectangular areas occupied by a segment of texts.
@ -177,9 +226,9 @@ DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,
// one if those characters
// are on the same line and use same font settings.
//
DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page,
int start_index,
int count);
FPDF_EXPORT int FPDF_CALLCONV FPDFText_CountRects(FPDF_TEXTPAGE text_page,
int start_index,
int count);
// Function: FPDFText_GetRect
// Get a rectangular area from the result generated by
@ -197,14 +246,18 @@ DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page,
// bottom - Pointer to a double value receiving the rectangle
// bottom boundary.
// Return Value:
// None.
// On success, return TRUE and fill in |left|, |top|, |right|, and
// |bottom|. If |text_page| is invalid then return FALSE, and the out
// parameters remain unmodified. If |text_page| is valid but
// |rect_index| is out of bounds, then return FALSE and set the out
// parameters to 0.
//
DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page,
int rect_index,
double* left,
double* top,
double* right,
double* bottom);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetRect(FPDF_TEXTPAGE text_page,
int rect_index,
double* left,
double* top,
double* right,
double* bottom);
// Function: FPDFText_GetBoundedText
// Extract unicode text within a rectangular boundary on the page.
@ -232,19 +285,22 @@ DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page,
// If the buffer is too small, as much text as will fit is copied into
// it.
//
DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
double left,
double top,
double right,
double bottom,
unsigned short* buffer,
int buflen);
FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
double left,
double top,
double right,
double bottom,
unsigned short* buffer,
int buflen);
// Flags used by FPDFText_FindStart function.
#define FPDF_MATCHCASE \
0x00000001 // If not set, it will not match case by default.
#define FPDF_MATCHWHOLEWORD \
0x00000002 // If not set, it will not match the whole word by default.
//
// If not set, it will not match case by default.
#define FPDF_MATCHCASE 0x00000001
// If not set, it will not match the whole word by default.
#define FPDF_MATCHWHOLEWORD 0x00000002
// If not set, it will skip past the current match to look for the next match.
#define FPDF_CONSECUTIVE 0x00000004
// Function: FPDFText_FindStart
// Start a search.
@ -258,10 +314,11 @@ DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
// A handle for the search context. FPDFText_FindClose must be called
// to release this handle.
//
DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page,
FPDF_WIDESTRING findwhat,
unsigned long flags,
int start_index);
FPDF_EXPORT FPDF_SCHHANDLE FPDF_CALLCONV
FPDFText_FindStart(FPDF_TEXTPAGE text_page,
FPDF_WIDESTRING findwhat,
unsigned long flags,
int start_index);
// Function: FPDFText_FindNext
// Search in the direction from page start to end.
@ -271,7 +328,7 @@ DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page,
// Return Value:
// Whether a match is found.
//
DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_FindNext(FPDF_SCHHANDLE handle);
// Function: FPDFText_FindPrev
// Search in the direction from page end to start.
@ -281,7 +338,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle);
// Return Value:
// Whether a match is found.
//
DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_FindPrev(FPDF_SCHHANDLE handle);
// Function: FPDFText_GetSchResultIndex
// Get the starting character index of the search result.
@ -291,7 +348,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle);
// Return Value:
// Index for the starting character.
//
DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
// Function: FPDFText_GetSchCount
// Get the number of matched characters in the search result.
@ -301,7 +358,7 @@ DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
// Return Value:
// Number of matched characters.
//
DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
// Function: FPDFText_FindClose
// Release a search context.
@ -311,7 +368,7 @@ DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
// Return Value:
// None.
//
DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle);
FPDF_EXPORT void FPDF_CALLCONV FPDFText_FindClose(FPDF_SCHHANDLE handle);
// Function: FPDFLink_LoadWebLinks
// Prepare information about weblinks in a page.
@ -336,7 +393,8 @@ DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle);
//
// FPDFLink_CloseWebLinks must be called to release resources.
//
DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
FPDF_EXPORT FPDF_PAGELINK FPDF_CALLCONV
FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
// Function: FPDFLink_CountWebLinks
// Count number of detected web links.
@ -345,7 +403,7 @@ DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
// Return Value:
// Number of detected web links.
//
DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
// Function: FPDFLink_GetURL
// Fetch the URL information for a detected web link.
@ -366,10 +424,10 @@ DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
// If |link_index| does not correspond to a valid link, then the result
// is an empty string.
//
DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page,
int link_index,
unsigned short* buffer,
int buflen);
FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetURL(FPDF_PAGELINK link_page,
int link_index,
unsigned short* buffer,
int buflen);
// Function: FPDFLink_CountRects
// Count number of rectangular areas for the link.
@ -380,8 +438,8 @@ DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page,
// Number of rectangular areas for the link. If |link_index| does
// not correspond to a valid link, then 0 is returned.
//
DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page,
int link_index);
FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountRects(FPDF_PAGELINK link_page,
int link_index);
// Function: FPDFLink_GetRect
// Fetch the boundaries of a rectangle for a link.
@ -398,16 +456,18 @@ DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page,
// bottom - Pointer to a double value receiving the rectangle
// bottom boundary.
// Return Value:
// None. If |link_index| does not correspond to a valid link, then
// |left|, |top|, |right|, and |bottom| remain unmodified.
// On success, return TRUE and fill in |left|, |top|, |right|, and
// |bottom|. If |link_page| is invalid or if |link_index| does not
// correspond to a valid link, then return FALSE, and the out
// parameters remain unmodified.
//
DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page,
int link_index,
int rect_index,
double* left,
double* top,
double* right,
double* bottom);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetRect(FPDF_PAGELINK link_page,
int link_index,
int rect_index,
double* left,
double* top,
double* right,
double* bottom);
// Function: FPDFLink_CloseWebLinks
// Release resources used by weblink feature.
@ -416,7 +476,7 @@ DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page,
// Return Value:
// None.
//
DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
FPDF_EXPORT void FPDF_CALLCONV FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
#ifdef __cplusplus
}

View File

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

View File

@ -10,6 +10,8 @@
#ifndef PUBLIC_FPDFVIEW_H_
#define PUBLIC_FPDFVIEW_H_
#include <stddef.h>
#if defined(_WIN32) && !defined(__WINDOWS__)
#include <windows.h>
#endif
@ -20,32 +22,44 @@
#define PDF_USE_XFA
#endif // PDF_ENABLE_XFA
// PDF types
typedef void* FPDF_ACTION;
typedef void* FPDF_BITMAP;
typedef void* FPDF_BOOKMARK;
typedef void* FPDF_CLIPPATH;
typedef void* FPDF_DEST;
typedef void* FPDF_DOCSCHHANDLE;
typedef void* FPDF_DOCUMENT;
typedef void* FPDF_FONT;
typedef void* FPDF_HMODULE;
typedef void* FPDF_LINK;
typedef void* FPDF_MODULEMGR;
typedef void* FPDF_PAGE;
typedef void* FPDF_PAGELINK;
typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc)
typedef void* FPDF_PAGERANGE;
typedef void* FPDF_PATH;
typedef void* FPDF_RECORDER;
typedef void* FPDF_SCHHANDLE;
typedef void* FPDF_STRUCTELEMENT;
typedef void* FPDF_STRUCTTREE;
typedef void* FPDF_TEXTPAGE;
// PDF object types
#define FPDF_OBJECT_UNKNOWN 0
#define FPDF_OBJECT_BOOLEAN 1
#define FPDF_OBJECT_NUMBER 2
#define FPDF_OBJECT_STRING 3
#define FPDF_OBJECT_NAME 4
#define FPDF_OBJECT_ARRAY 5
#define FPDF_OBJECT_DICTIONARY 6
#define FPDF_OBJECT_STREAM 7
#define FPDF_OBJECT_NULLOBJ 8
#define FPDF_OBJECT_REFERENCE 9
// PDF types - use incomplete types for type safety.
typedef const struct fpdf_action_t__* FPDF_ACTION;
typedef struct fpdf_annotation_t__* FPDF_ANNOTATION;
typedef struct fpdf_attachment_t__* FPDF_ATTACHMENT;
typedef struct fpdf_bitmap_t__* FPDF_BITMAP;
typedef const struct fpdf_bookmark_t__* FPDF_BOOKMARK;
typedef struct fpdf_clippath_t__* FPDF_CLIPPATH;
typedef const struct fpdf_dest_t__* FPDF_DEST;
typedef struct fpdf_document_t__* FPDF_DOCUMENT;
typedef struct fpdf_font_t__* FPDF_FONT;
typedef struct fpdf_form_handle_t__* FPDF_FORMHANDLE;
typedef struct fpdf_link_t__* FPDF_LINK;
typedef struct fpdf_page_t__* FPDF_PAGE;
typedef struct fpdf_pagelink_t__* FPDF_PAGELINK;
typedef struct fpdf_pageobject_t__* FPDF_PAGEOBJECT; // (text, path, etc.)
typedef struct fpdf_pageobjectmark_t__* FPDF_PAGEOBJECTMARK;
typedef const struct fpdf_pagerange_t__* FPDF_PAGERANGE;
typedef const struct fpdf_pathsegment_t* FPDF_PATHSEGMENT;
typedef void* FPDF_RECORDER; // Passed into skia.
typedef struct fpdf_schhandle_t__* FPDF_SCHHANDLE;
typedef struct fpdf_structelement_t__* FPDF_STRUCTELEMENT;
typedef struct fpdf_structtree_t__* FPDF_STRUCTTREE;
typedef struct fpdf_textpage_t__* FPDF_TEXTPAGE;
#ifdef PDF_ENABLE_XFA
typedef void* FPDF_STRINGHANDLE;
typedef void* FPDF_WIDGET;
typedef struct fpdf_widget_t__* FPDF_WIDGET;
#endif // PDF_ENABLE_XFA
// Basic data types
@ -101,7 +115,14 @@ typedef struct _FPDF_BSTR {
// system wide string by yourself.
typedef const char* FPDF_STRING;
// Matrix for transformation.
// Matrix for transformation, in the form [a b c d e f], equivalent to:
// | a b 0 |
// | c d 0 |
// | e f 1 |
//
// Translation is performed with [1 0 0 1 tx ty].
// Scaling is performed with [sx 0 0 sy 0 0].
// See PDF Reference 1.7, 4.2.2 Common Transformations for more.
typedef struct _FS_MATRIX_ {
float a;
float b;
@ -126,19 +147,26 @@ typedef struct _FS_RECTF_ {
// Const Pointer to FS_RECTF structure.
typedef const FS_RECTF* FS_LPCRECTF;
#if defined(_WIN32) && defined (_MSC_VER)
// Annotation enums.
typedef int FPDF_ANNOTATION_SUBTYPE;
typedef int FPDF_ANNOT_APPEARANCEMODE;
// Dictionary value types.
typedef int FPDF_OBJECT_TYPE;
#if defined(_WIN32)
#if defined(FPDFSDK_EXPORTS)
// On Windows system, functions are exported in a DLL
#define DLLEXPORT __declspec(dllexport)
#define STDCALL __stdcall
#else
#define DLLEXPORT __declspec(dllimport)
#define STDCALL __stdcall
#endif //FPDF_EXPORTS
#define FPDF_EXPORT __declspec(dllexport)
#define FPDF_CALLCONV __cdecl
#else
#define DLLEXPORT __declspec(dllimport)
#define STDCALL __stdcall
#endif //WIN32
#define FPDF_EXPORT __declspec(dllimport)
#define FPDF_CALLCONV __cdecl
#endif
#else
#define FPDF_EXPORT
#define FPDF_CALLCONV
#endif
// Exported Functions
#ifdef __cplusplus
@ -154,7 +182,7 @@ extern "C" {
// Comments:
// Convenience function to call FPDF_InitLibraryWithConfig() for
// backwards comatibility purposes.
DLLEXPORT void STDCALL FPDF_InitLibrary();
FPDF_EXPORT void FPDF_CALLCONV FPDF_InitLibrary();
// Process-wide options for initializing the library.
typedef struct FPDF_LIBRARY_CONFIG_ {
@ -188,8 +216,8 @@ typedef struct FPDF_LIBRARY_CONFIG_ {
// Comments:
// You have to call this function before you can call any PDF
// processing functions.
DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig(
const FPDF_LIBRARY_CONFIG* config);
FPDF_EXPORT void FPDF_CALLCONV
FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* config);
// Function: FPDF_DestroyLibary
// Release all resources allocated by the FPDFSDK library.
@ -202,7 +230,7 @@ DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig(
// the library.
// After this function is called, you should not call any PDF
// processing functions.
DLLEXPORT void STDCALL FPDF_DestroyLibrary();
FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary();
// Policy for accessing the local machine time.
#define FPDF_POLICY_MACHINETIME_ACCESS 0
@ -215,8 +243,8 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary();
// enable - True to enable, false to disable the policy.
// Return value:
// None.
DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy,
FPDF_BOOL enable);
FPDF_EXPORT void FPDF_CALLCONV FPDF_SetSandBoxPolicy(FPDF_DWORD policy,
FPDF_BOOL enable);
#if defined(_WIN32)
#if defined(PDFIUM_PRINT_TEXT_WITH_GDI)
@ -234,7 +262,7 @@ typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font,
// func - A function pointer. See description above.
// Return value:
// None.
DLLEXPORT void STDCALL
FPDF_EXPORT void FPDF_CALLCONV
FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func);
// Function: FPDF_SetPrintTextWithGDI
@ -244,20 +272,27 @@ FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func);
// use_gdi - Set to true to enable printing text with GDI.
// Return value:
// None.
DLLEXPORT void STDCALL FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi);
FPDF_EXPORT void FPDF_CALLCONV FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi);
#endif // PDFIUM_PRINT_TEXT_WITH_GDI
// Function: FPDF_SetPrintPostscriptLevel
// Set postscript printing level when printing on Windows.
// Function: FPDF_SetPrintMode
// Set printing mode when printing on Windows.
// Experimental API.
// Parameters:
// postscript_level - 0 to disable postscript printing,
// 2 to print with postscript level 2,
// 3 to print with postscript level 3.
// All other values are invalid.
// mode - FPDF_PRINTMODE_EMF to output EMF (default)
// FPDF_PRINTMODE_TEXTONLY to output text only (for charstream
// devices)
// FPDF_PRINTMODE_POSTSCRIPT2 to output level 2 PostScript into
// EMF as a series of GDI comments.
// FPDF_PRINTMODE_POSTSCRIPT3 to output level 3 PostScript into
// EMF as a series of GDI comments.
// FPDF_PRINTMODE_POSTSCRIPT2_PASSTHROUGH to output level 2
// PostScript via ExtEscape() in PASSTHROUGH mode.
// FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH to output level 3
// PostScript via ExtEscape() in PASSTHROUGH mode.
// Return value:
// True if successful, false if unsucessful (typically invalid input).
DLLEXPORT FPDF_BOOL STDCALL FPDF_SetPrintPostscriptLevel(FPDF_BOOL use_gdi);
// True if successful, false if unsuccessful (typically invalid input).
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_SetPrintMode(int mode);
#endif // defined(_WIN32)
// Function: FPDF_LoadDocument
@ -266,14 +301,21 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_SetPrintPostscriptLevel(FPDF_BOOL use_gdi);
// file_path - Path to the PDF file (including extension).
// password - A string used as the password for the PDF file.
// If no password is needed, empty or NULL can be used.
// See comments below regarding the encoding.
// Return value:
// A handle to the loaded document, or NULL on failure.
// Comments:
// Loaded document can be closed by FPDF_CloseDocument().
// If this function fails, you can use FPDF_GetLastError() to retrieve
// the reason why it failed.
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path,
FPDF_BYTESTRING password);
//
// The encoding for |password| can be either UTF-8 or Latin-1. PDFs,
// depending on the security handler revision, will only accept one or
// the other encoding. If |password|'s encoding and the PDF's expected
// encoding do not match, FPDF_LoadDocument() will automatically
// convert |password| to the other encoding.
FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BYTESTRING password);
// Function: FPDF_LoadMemDocument
// Open and load a PDF document from memory.
@ -289,13 +331,15 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path,
// The loaded document can be closed by FPDF_CloseDocument.
// If this function fails, you can use FPDF_GetLastError() to retrieve
// the reason why it failed.
//
// See the comments for FPDF_LoadDocument() regarding the encoding for
// |password|.
// Notes:
// If PDFium is built with the XFA module, the application should call
// FPDF_LoadXFA() function after the PDF document loaded to support XFA
// fields defined in the fpdfformfill.h file.
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf,
int size,
FPDF_BYTESTRING password);
FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
FPDF_LoadMemDocument(const void* data_buf, int size, FPDF_BYTESTRING password);
// Structure for custom file access.
typedef struct {
@ -304,6 +348,7 @@ typedef struct {
// A function pointer for getting a block of data from a specific position.
// Position is specified by byte offset from the beginning of the file.
// The pointer to the buffer is never NULL and the size is never 0.
// The position and size will never go out of range of the file length.
// It may be possible for FPDFSDK to call this function multiple times for
// the same position.
@ -403,7 +448,8 @@ typedef struct _FPDF_FILEHANDLER {
FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size);
} FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER;
#endif
#endif // PDF_ENABLE_XFA
// Function: FPDF_LoadCustomDocument
// Load PDF document from a custom access descriptor.
// Parameters:
@ -412,15 +458,19 @@ typedef struct _FPDF_FILEHANDLER {
// Return value:
// A handle to the loaded document, or NULL on failure.
// Comments:
// The application must keep the file resources valid until the PDF
// document is closed.
// The application must keep the file resources |pFileAccess| points to
// valid until the returned FPDF_DOCUMENT is closed. |pFileAccess|
// itself does not need to outlive the FPDF_DOCUMENT.
//
// The loaded document can be closed with FPDF_CloseDocument.
// The loaded document can be closed with FPDF_CloseDocument().
//
// See the comments for FPDF_LoadDocument() regarding the encoding for
// |password|.
// Notes:
// If PDFium is built with the XFA module, the application should call
// FPDF_LoadXFA() function after the PDF document loaded to support XFA
// fields defined in the fpdfformfill.h file.
DLLEXPORT FPDF_DOCUMENT STDCALL
FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV
FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password);
// Function: FPDF_GetFileVersion
@ -434,8 +484,8 @@ FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password);
// Comments:
// If the document was created by FPDF_CreateNewDocument,
// then this function will always fail.
DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc,
int* fileVersion);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetFileVersion(FPDF_DOCUMENT doc,
int* fileVersion);
#define FPDF_ERR_SUCCESS 0 // No error.
#define FPDF_ERR_UNKNOWN 1 // Unknown error.
@ -458,7 +508,22 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc,
// Comments:
// If the previous SDK call succeeded, the return value of this
// function is not defined.
DLLEXPORT unsigned long STDCALL FPDF_GetLastError();
FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetLastError();
// Function: FPDF_DocumentHasValidCrossReferenceTable
// Whether the document's cross reference table is valid or not.
// Experimental API.
// Parameters:
// document - Handle to a document. Returned by FPDF_LoadDocument.
// Return value:
// True if the PDF parser did not encounter problems parsing the cross
// reference table. False if the parser could not parse the cross
// reference table and the table had to be rebuild from other data
// within the document.
// Comments:
// The return value can change over time as the PDF parser evolves.
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDF_DocumentHasValidCrossReferenceTable(FPDF_DOCUMENT document);
// Function: FPDF_GetDocPermission
// Get file permission flags of the document.
@ -468,7 +533,8 @@ DLLEXPORT unsigned long STDCALL FPDF_GetLastError();
// A 32-bit integer indicating permission flags. Please refer to the
// PDF Reference for detailed descriptions. If the document is not
// protected, 0xffffffff will be returned.
DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document);
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_GetDocPermissions(FPDF_DOCUMENT document);
// Function: FPDF_GetSecurityHandlerRevision
// Get the revision for the security handler.
@ -478,7 +544,8 @@ DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document);
// The security handler revision number. Please refer to the PDF
// Reference for a detailed description. If the document is not
// protected, -1 will be returned.
DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document);
FPDF_EXPORT int FPDF_CALLCONV
FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document);
// Function: FPDF_GetPageCount
// Get total number of pages in the document.
@ -486,7 +553,7 @@ DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document);
// document - Handle to document. Returned by FPDF_LoadDocument.
// Return value:
// Total number of pages in the document.
DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document);
FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageCount(FPDF_DOCUMENT document);
// Function: FPDF_LoadPage
// Load a page inside the document.
@ -498,8 +565,8 @@ DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document);
// Comments:
// The loaded page can be rendered to devices using FPDF_RenderPage.
// The loaded page can be closed using FPDF_ClosePage.
DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
int page_index);
FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDF_LoadPage(FPDF_DOCUMENT document,
int page_index);
// Function: FPDF_GetPageWidth
// Get page width.
@ -508,7 +575,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
// Return value:
// Page width (excluding non-displayable area) measured in points.
// One point is 1/72 inch (around 0.3528 mm).
DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page);
FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageWidth(FPDF_PAGE page);
// Function: FPDF_GetPageHeight
// Get page height.
@ -517,7 +584,20 @@ DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page);
// Return value:
// Page height (excluding non-displayable area) measured in points.
// One point is 1/72 inch (around 0.3528 mm)
DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page);
FPDF_EXPORT double FPDF_CALLCONV FPDF_GetPageHeight(FPDF_PAGE page);
// Experimental API.
// Function: FPDF_GetPageBoundingBox
// Get the bounding box of the page. This is the intersection between
// its media box and its crop box.
// Parameters:
// page - Handle to the page. Returned by FPDF_LoadPage.
// rect - Pointer to a rect to receive the page bounding box.
// On an error, |rect| won't be filled.
// Return value:
// True for success.
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetPageBoundingBox(FPDF_PAGE page,
FS_RECTF* rect);
// Function: FPDF_GetPageSizeByIndex
// Get the size of the page at the given index.
@ -530,10 +610,10 @@ DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page);
// (in points).
// Return value:
// Non-zero for success. 0 for error (document or page not found).
DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
int page_index,
double* width,
double* height);
FPDF_EXPORT int FPDF_CALLCONV FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
int page_index,
double* width,
double* height);
// Page rendering flags. They can be combined with bit-wise OR.
//
@ -587,14 +667,14 @@ DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document,
// defined above.
// Return value:
// None.
DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags);
FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage(HDC dc,
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags);
#endif
// Function: FPDF_RenderPageBitmap
@ -602,7 +682,8 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
// Parameters:
// bitmap - Handle to the device independent bitmap (as the
// output buffer). The bitmap handle can be created
// by FPDFBitmap_Create.
// by FPDFBitmap_Create or retrieved from an image
// object by FPDFImageObj_GetBitmap.
// page - Handle to the page. Returned by FPDF_LoadPage
// start_x - Left pixel position of the display area in
// bitmap coordinates.
@ -622,41 +703,44 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
// widget and popup annotations.
// Return value:
// None.
DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags);
FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags);
// Function: FPDF_RenderPageBitmapWithMatrix
// Render contents of a page to a device independent bitmap.
// Parameters:
// bitmap - Handle to the device independent bitmap (as the
// output buffer). The bitmap handle can be created
// by FPDFBitmap_Create.
// page - Handle to the page. Returned by FPDF_LoadPage
// matrix - The transform matrix.
// clipping - The rect to clip to.
// by FPDFBitmap_Create or retrieved by
// FPDFImageObj_GetBitmap.
// page - Handle to the page. Returned by FPDF_LoadPage.
// matrix - The transform matrix, which must be invertible.
// See PDF Reference 1.7, 4.2.2 Common Transformations.
// clipping - The rect to clip to in device coords.
// flags - 0 for normal display, or combination of the Page
// Rendering flags defined above. With the FPDF_ANNOT
// flag, it renders all annotations that do not require
// user-interaction, which are all annotations except
// widget and popup annotations.
// Return value:
// None.
DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap,
FPDF_PAGE page,
const FS_MATRIX* matrix,
const FS_RECTF* clipping,
int flags);
// None. Note that behavior is undefined if det of |matrix| is 0.
FPDF_EXPORT void FPDF_CALLCONV
FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap,
FPDF_PAGE page,
const FS_MATRIX* matrix,
const FS_RECTF* clipping,
int flags);
#ifdef _SKIA_SUPPORT_
DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page,
int size_x,
int size_y);
FPDF_EXPORT FPDF_RECORDER FPDF_CALLCONV FPDF_RenderPageSkp(FPDF_PAGE page,
int size_x,
int size_y);
#endif
// Function: FPDF_ClosePage
@ -665,7 +749,7 @@ DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page,
// page - Handle to the loaded page.
// Return value:
// None.
DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);
FPDF_EXPORT void FPDF_CALLCONV FPDF_ClosePage(FPDF_PAGE page);
// Function: FPDF_CloseDocument
// Close a loaded PDF document.
@ -673,7 +757,7 @@ DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page);
// document - Handle to the loaded document.
// Return value:
// None.
DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
FPDF_EXPORT void FPDF_CALLCONV FPDF_CloseDocument(FPDF_DOCUMENT document);
// Function: FPDF_DeviceToPage
// Convert the screen coordinates of a point to page coordinates.
@ -697,7 +781,8 @@ DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
// page_y - A pointer to a double receiving the converted Y
// value in page coordinates.
// Return value:
// None.
// Returns true if the conversion succeeds, and |page_x| and |page_y|
// successfully receives the converted coordinates.
// Comments:
// The page coordinate system has its origin at the left-bottom corner
// of the page, with the X-axis on the bottom going to the right, and
@ -715,16 +800,16 @@ DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document);
// You must make sure the start_x, start_y, size_x, size_y
// and rotate parameters have exactly same values as you used in
// the FPDF_RenderPage() function call.
DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int device_x,
int device_y,
double* page_x,
double* page_y);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_DeviceToPage(FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int device_x,
int device_y,
double* page_x,
double* page_y);
// Function: FPDF_PageToDevice
// Convert the page coordinates of a point to screen coordinates.
@ -748,19 +833,20 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page,
// device_y - A pointer to an integer receiving the result Y
// value in device coordinates.
// Return value:
// None.
// Returns true if the conversion succeeds, and |device_x| and
// |device_y| successfully receives the converted coordinates.
// Comments:
// See comments for FPDF_DeviceToPage().
DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
double page_x,
double page_y,
int* device_x,
int* device_y);
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_PageToDevice(FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
double page_x,
double page_y,
int* device_x,
int* device_y);
// Function: FPDFBitmap_Create
// Create a device independent bitmap (FXDIB).
@ -791,11 +877,13 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page,
// This function allocates enough memory for holding all pixels in the
// bitmap, but it doesn't initialize the buffer. Applications can use
// FPDFBitmap_FillRect to fill the bitmap using any color.
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width,
int height,
int alpha);
FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_Create(int width,
int height,
int alpha);
// More DIB formats
// Unknown or unsupported format.
#define FPDFBitmap_Unknown 0
// Gray scale bitmap, one byte per pixel.
#define FPDFBitmap_Gray 1
// 3 bytes per pixel, byte order: blue, green, red.
@ -830,11 +918,23 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width,
// If an external buffer is used, then the application should destroy
// the buffer by itself. FPDFBitmap_Destroy function will not destroy
// the buffer.
DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width,
int height,
int format,
void* first_scan,
int stride);
FPDF_EXPORT FPDF_BITMAP FPDF_CALLCONV FPDFBitmap_CreateEx(int width,
int height,
int format,
void* first_scan,
int stride);
// Function: FPDFBitmap_GetFormat
// Get the format of the bitmap.
// Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value:
// The format of the bitmap.
// Comments:
// Only formats supported by FPDFBitmap_CreateEx are supported by this
// function; see the list of such formats above.
FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetFormat(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_FillRect
// Fill a rectangle in a bitmap.
@ -860,17 +960,18 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width,
// background will be replaced by the source color and the alpha.
//
// If the alpha channel is not used, the alpha parameter is ignored.
DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
int left,
int top,
int width,
int height,
FPDF_DWORD color);
FPDF_EXPORT void FPDF_CALLCONV FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
int left,
int top,
int width,
int height,
FPDF_DWORD color);
// Function: FPDFBitmap_GetBuffer
// Get data buffer of a bitmap.
// Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create.
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value:
// The pointer to the first byte of the bitmap buffer.
// Comments:
@ -882,44 +983,48 @@ DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
//
// The data is in BGRA format. Where the A maybe unused if alpha was
// not specified.
DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
FPDF_EXPORT void* FPDF_CALLCONV FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_GetWidth
// Get width of a bitmap.
// Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create.
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value:
// The width of the bitmap in pixels.
DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);
FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetWidth(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_GetHeight
// Get height of a bitmap.
// Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create.
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value:
// The height of the bitmap in pixels.
DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);
FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetHeight(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_GetStride
// Get number of bytes for each line in the bitmap buffer.
// Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create.
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value:
// The number of bytes for each line in the bitmap buffer.
// Comments:
// The stride may be more than width * number of bytes per pixel.
DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap);
FPDF_EXPORT int FPDF_CALLCONV FPDFBitmap_GetStride(FPDF_BITMAP bitmap);
// Function: FPDFBitmap_Destroy
// Destroy a bitmap and release all related buffers.
// Parameters:
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create.
// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create
// or FPDFImageObj_GetBitmap.
// Return value:
// None.
// Comments:
// This function will not destroy any external buffers provided when
// the bitmap was created.
DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap);
FPDF_EXPORT void FPDF_CALLCONV FPDFBitmap_Destroy(FPDF_BITMAP bitmap);
// Function: FPDF_VIEWERREF_GetPrintScaling
// Whether the PDF document prefers to be scaled or not.
@ -927,7 +1032,7 @@ DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap);
// document - Handle to the loaded document.
// Return value:
// None.
DLLEXPORT FPDF_BOOL STDCALL
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
// Function: FPDF_VIEWERREF_GetNumCopies
@ -936,7 +1041,8 @@ FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document);
// document - Handle to the loaded document.
// Return value:
// The number of copies to be printed.
DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document);
FPDF_EXPORT int FPDF_CALLCONV
FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document);
// Function: FPDF_VIEWERREF_GetPrintPageRange
// Page numbers to initialize print dialog box when file is printed.
@ -944,9 +1050,31 @@ DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document);
// document - Handle to the loaded document.
// Return value:
// The print page range to be used for printing.
DLLEXPORT FPDF_PAGERANGE STDCALL
FPDF_EXPORT FPDF_PAGERANGE FPDF_CALLCONV
FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document);
// Function: FPDF_VIEWERREF_GetPrintPageRangeCount
// Returns the number of elements in a FPDF_PAGERANGE.
// Experimental API.
// Parameters:
// pagerange - Handle to the page range.
// Return value:
// The number of elements in the page range. Returns 0 on error.
FPDF_EXPORT size_t FPDF_CALLCONV
FPDF_VIEWERREF_GetPrintPageRangeCount(FPDF_PAGERANGE pagerange);
// Function: FPDF_VIEWERREF_GetPrintPageRangeElement
// Returns an element from a FPDF_PAGERANGE.
// Experimental API.
// Parameters:
// pagerange - Handle to the page range.
// index - Index of the element.
// Return value:
// The value of the element in the page range at a given index.
// Returns -1 on error.
FPDF_EXPORT int FPDF_CALLCONV
FPDF_VIEWERREF_GetPrintPageRangeElement(FPDF_PAGERANGE pagerange, size_t index);
// Function: FPDF_VIEWERREF_GetDuplex
// Returns the paper handling option to be used when printing from
// the print dialog.
@ -954,7 +1082,7 @@ FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document);
// document - Handle to the loaded document.
// Return value:
// The paper handling option to be used when printing.
DLLEXPORT FPDF_DUPLEXTYPE STDCALL
FPDF_EXPORT FPDF_DUPLEXTYPE FPDF_CALLCONV
FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
// Function: FPDF_VIEWERREF_GetName
@ -962,7 +1090,8 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
// be of type "name".
// Parameters:
// document - Handle to the loaded document.
// key - Name of the key in the viewer pref dictionary.
// key - Name of the key in the viewer pref dictionary,
// encoded in UTF-8.
// buffer - A string to write the contents of the key to.
// length - Length of the buffer.
// Return value:
@ -971,10 +1100,11 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document);
// as when |document| is invalid or |buffer| is NULL. If |length| is
// less than the returned length, or |buffer| is NULL, |buffer| will
// not be modified.
DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document,
FPDF_BYTESTRING key,
char* buffer,
unsigned long length);
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document,
FPDF_BYTESTRING key,
char* buffer,
unsigned long length);
// Function: FPDF_CountNamedDests
// Get the count of named destinations in the PDF document.
@ -982,7 +1112,8 @@ DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document,
// document - Handle to a document
// Return value:
// The count of named destinations.
DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document);
FPDF_EXPORT FPDF_DWORD FPDF_CALLCONV
FPDF_CountNamedDests(FPDF_DOCUMENT document);
// Function: FPDF_GetNamedDestByName
// Get a the destination handle for the given name.
@ -991,8 +1122,8 @@ DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document);
// name - The name of a destination.
// Return value:
// The handle to the destination.
DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,
FPDF_BYTESTRING name);
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV
FPDF_GetNamedDestByName(FPDF_DOCUMENT document, FPDF_BYTESTRING name);
// Function: FPDF_GetNamedDest
// Get the named destination by index.
@ -1015,25 +1146,38 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,
//
// If buflen is not sufficiently large, it will be set to -1 upon
// return.
DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document,
int index,
void* buffer,
long* buflen);
FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document,
int index,
void* buffer,
long* buflen);
#ifdef PDF_ENABLE_V8
// Function: FPDF_GetRecommendedV8Flags
// Returns a space-separated string of command line flags that are
// recommended to be passed into V8 via V8::SetFlagsFromString()
// prior to initializing the PDFium library.
// Parameters:
// None.
// Return value:
// NUL-terminated string of the form "--flag1 --flag2".
// The caller must not attempt to modify or free the result.
FPDF_EXPORT const char* FPDF_CALLCONV FPDF_GetRecommendedV8Flags();
#endif // PDF_ENABLE_V8
#ifdef PDF_ENABLE_XFA
// Function: FPDF_BStr_Init
// Helper function to initialize a byte string.
DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str);
FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Init(FPDF_BSTR* str);
// Function: FPDF_BStr_Set
// Helper function to set string data.
DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str,
FPDF_LPCSTR bstr,
int length);
FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Set(FPDF_BSTR* str,
FPDF_LPCSTR bstr,
int length);
// Function: FPDF_BStr_Clear
// Helper function to clear a byte string.
DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str);
FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Clear(FPDF_BSTR* str);
#endif // PDF_ENABLE_XFA
#ifdef __cplusplus

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.