PDF Page

Definitions for access to PDF page.
Definitions and functions in this module are included in fpdf_page_r.h and fpdf_page_w.h.
Module: PDFPage
License Identifier: PDFPage/All
Available License Right: Reading/Writing
For License Right Reading, see fpdf_page_r.h.
For License Right Writing, see fpdf_page_w.h. More...

Functions

FS_RESULT FSPDF_Page_StartParse (FSCRT_PAGE page, FS_DWORD flag, FSCRT_PROGRESS *parseProgress)
 Start parsing a PDF page. More...
 
FS_RESULT FSPDF_Page_IsParsed (FSCRT_PAGE page, FS_BOOL *isParsed)
 Determine whether page has been parsed or not. More...
 
FS_RESULT FSPDF_Page_Clear (FSCRT_PAGE page)
 Release all page contents and related resources. More...
 
FS_RESULT FSPDF_Page_GetIndex (FSCRT_PAGE page, FS_INT32 *index)
 Get page index. More...
 
FS_RESULT FSPDF_Page_GetSize (FSCRT_PAGE page, FS_FLOAT *width, FS_FLOAT *height)
 Get page size. More...
 
FS_RESULT FSPDF_Page_GetRotation (FSCRT_PAGE page, FS_INT32 *rotation)
 Get page rotation. More...
 
FS_RESULT FSPDF_Page_GetBox (FSCRT_PAGE page, FS_INT32 boxType, FSCRT_RECTF *pageBox)
 Get page boundary which is a rectangle type value. More...
 
FS_RESULT FSPDF_Page_GetDict (FSCRT_PAGE page, FSPDF_OBJECT *dictionary)
 Get the PDF page dictionary object. More...
 
FS_RESULT FSPDF_Page_EstimateContentSize (FSCRT_PAGE page, FS_DWORD *contentSize)
 Estimate the size of PDF page content. More...
 
FS_RESULT FSPDF_Page_HasTransparency (FSCRT_PAGE page, FS_BOOL *hasTransparency)
 Check whether a PDF page has transparency. More...
 
FS_RESULT FSPDF_Page_CountActions (FSCRT_PAGE page, FS_INT32 trigger, FS_INT32 *count)
 Count trigger actions of a PDF page. More...
 
FS_RESULT FSPDF_Page_GetAction (FSCRT_PAGE page, FS_INT32 trigger, FS_INT32 index, FSPDF_ACTIONDATA *actionData)
 Get a trigger action of a PDF page. More...
 
FS_RESULT FSPDF_Page_DoJavaScriptAction (FSCRT_PAGE page, FS_INT32 trigger)
 Perform the page javascript which is specified by the trigger. More...
 
FS_RESULT FSPDF_Page_GetMatrix (FSCRT_PAGE page, FS_INT32 x, FS_INT32 y, FS_INT32 width, FS_INT32 height, FS_INT32 rotation, FSCRT_MATRIX *matrix)
 Get page transformation matrix. More...
 
FS_RESULT FSPDF_Matrix_TransformPageToDevice (FSCRT_MATRIX *matrix, const FSCRT_RECTF *srcRect, const FSCRT_RECT *dstRect, FS_INT32 rotation)
 Get a transformation matrix from PDF page coordinate to device coordinate. More...
 
FS_RESULT FSPDF_Matrix_TransformDeviceToPage (FSCRT_MATRIX *matrix, const FSCRT_RECT *srcRect, const FSCRT_RECTF *dstRect, FS_INT32 rotation)
 Get a transformation matrix from device coordinate to PDF page coordinate. More...
 
FS_RESULT FSPDF_Page_CalcContentBBox (FSCRT_PAGE page, FS_INT32 mode, FSCRT_RECTF *rectBBox)
 Calculate content box rectangle in PDF page. More...
 
FS_RESULT FSPDF_Page_GetThumbnail (FSCRT_PAGE page, FSCRT_BITMAP *thumbnail)
 Get the thumbnail bitmap from a page. More...
 
FS_RESULT FSPDF_RenderContext_StartPage (FSPDF_RENDERCONTEXT pdfRenderContext, FSCRT_RENDERER renderer, FSCRT_PAGE page, FS_INT32 flag, FSCRT_PROGRESS *renderProgress)
 Start rendering a PDF page in a renderer with a PDF rendering context. More...
 
FS_RESULT FSPDF_Page_SetIndex (FSCRT_PAGE page, FS_INT32 index)
 Change page index of a PDF page. More...
 
FS_RESULT FSPDF_Page_SetSize (FSCRT_PAGE page, FS_FLOAT width, FS_FLOAT height)
 Set page size. More...
 
FS_RESULT FSPDF_Page_SetRotation (FSCRT_PAGE page, FS_INT32 rotation)
 Set page rotation. More...
 
FS_RESULT FSPDF_Page_SetBox (FSCRT_PAGE page, FS_INT32 boxType, const FSCRT_RECTF *pageBox)
 Set page box which is a rectangle type of value. More...
 
FS_RESULT FSPDF_Page_SetAction (FSCRT_PAGE page, FS_INT32 trigger, FS_INT32 index, const FSPDF_ACTIONDATA *actionData)
 Set a page trigger action. More...
 
FS_RESULT FSPDF_Page_InsertAction (FSCRT_PAGE page, FS_INT32 trigger, FS_INT32 index, const FSPDF_ACTIONDATA *actionData)
 Insert a page trigger action. More...
 
FS_RESULT FSPDF_Page_RemoveAction (FSCRT_PAGE page, FS_INT32 trigger, FS_INT32 index)
 Remove a page trigger action. More...
 
FS_RESULT FSPDF_Page_RemoveAllActions (FSCRT_PAGE page, FS_INT32 trigger)
 Remove all trigger actions of a PDF page. More...
 
FS_RESULT FSPDF_Page_Transform (FSCRT_PAGE page, const FSCRT_MATRIX *matrix, FS_BOOL needTransformClipPath)
 Transform a PDF page, including the annotations and form fields on the page. More...
 
FS_RESULT FSPDF_Page_SetClipRect (FSCRT_PAGE page, const FSCRT_RECTF *clipRect)
 Set clip rectangle for all page objects on PDF page. More...
 
FS_RESULT FSPDF_Page_Create (FSCRT_DOCUMENT document, FS_INT32 index, FSCRT_PAGE *page)
 Create a new page to a position specified by the index. More...
 
FS_RESULT FSPDF_Page_Delete (FSCRT_PAGE page)
 Delete a page from document. More...
 
FS_RESULT FSPDF_Page_Flatten (FSCRT_PAGE page, FS_DWORD flags)
 Flatten a PDF page, and annotations or form fields will be made to be a part of the page contents. More...
 
FS_RESULT FSPDF_Page_SetThumbnail (FSCRT_PAGE page, FSCRT_BITMAP thumbnail)
 Set a thumbnail bitmap to a page. More...
 

Macro Definitions for PDF Page Parsing Flags

Note
There are two PDF page parsing modes: one is normal, and the other one is for text only. Non-text objects in page will be omitted.
#define FSPDF_PAGEPARSEFLAG_NORMAL   0
 PDF page parsing flag for normal mode.
 
#define FSPDF_PAGEPARSEFLAG_TEXTONLY   1
 PDF page parsing flag for text-only mode.
 

Macro Definitions for Page Margin

Note
Currently Foxit PDF SDK supports two modes to calculate page margin:
1) analyzing bounding box of all page contents. 2) detecting paths for background and images.
#define FSPDF_PAGEMARGIN_CONTENTSBBOX   0
 Calculate margin according to bounding box of all contents.
 
#define FSPDF_PAGEMARGIN_DETECTION   1
 Calculate margin by detecting paths or images.
 

Macro Definitions for PDF Page Render Flags

Note
There are two PDF page render modes: one is normal, and the other one is for quick draw page content.
#define FSPDF_PAGERENDERFLAG_NORMAL   0
 PDF page render flag for normal mode.
 
#define FSPDF_PAGERENDERFLAG_QUICKDRAW   1
 PDF page parsing flag for quick draw mode.
 

Macro Definitions for Flatten Option

Note
These are used for indicating the option of flatten.
#define FSPDF_FLATTENFLAG_DISPLAY   0
 Flatten contents for displaying and it can be combined with any flags except FSPDF_FLATTENFLAG_PRINT.
 
#define FSPDF_FLATTENFLAG_PRINT   1
 Flatten contents for printing and it can be combined with any flags except FSPDF_FLATTENFLAG_DISPLAY. More...
 
#define FSPDF_FLATTENFLAG_NOANNOT   2
 Flatten contents without annotations except widget annotations and it should be combined with FSPDF_FLATTENFLAG_PRINT or FSPDF_FLATTENFLAG_DISPLAY.
 
#define FSPDF_FLATTENFLAG_NOFORMCONTROL   4
 Flatten contents without form controls and it should be combined with FSPDF_FLATTENFLAG_PRINT or FSPDF_FLATTENFLAG_DISPLAY.
 

Detailed Description

Definitions for access to PDF page.
Definitions and functions in this module are included in fpdf_page_r.h and fpdf_page_w.h.
Module: PDFPage
License Identifier: PDFPage/All
Available License Right: Reading/Writing
For License Right Reading, see fpdf_page_r.h.
For License Right Writing, see fpdf_page_w.h.

This module contains following features:

Macro Definition Documentation

#define FSPDF_FLATTENFLAG_PRINT   1

Flatten contents for printing and it can be combined with any flags except FSPDF_FLATTENFLAG_DISPLAY.

Note
Specially, text, file attachment and sound annotations will be ignored.

Function Documentation

FS_RESULT FSPDF_Matrix_TransformDeviceToPage ( FSCRT_MATRIX matrix,
const FSCRT_RECT srcRect,
const FSCRT_RECTF dstRect,
FS_INT32  rotation 
)

Get a transformation matrix from device coordinate to PDF page coordinate.

Parameters
[out]matrixPointer to a FSCRT_MATRIX structure that receives the transformation matrix. If there is any error, it will be [1 0 0 1 0 0].
[in]srcRectPointer to a FSCRT_RECT structure which is a rectangle in device coordinate.
[in]dstRectPointer to a FSCRT_RECTF structure which is a rectangle in PDF page coordinate.
[in]rotationRotation value for parameter srcRect to map dstRect. Please refer to macro definitions FSCRT_PAGEROTATION_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter matrix or srcRect or dstRect is a NULL pointer, or rotation is an invalid value.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This is a helper function to get a transformation matrix from device coordinate to PDF page coordinate.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Matrix_TransformPageToDevice ( FSCRT_MATRIX matrix,
const FSCRT_RECTF srcRect,
const FSCRT_RECT dstRect,
FS_INT32  rotation 
)

Get a transformation matrix from PDF page coordinate to device coordinate.

Parameters
[out]matrixPointer to a FSCRT_MATRIX structure that receives the transformation matrix. If there is any error, it will be [1 0 0 1 0 0].
[in]srcRectPointer to a FSCRT_RECTF structure which is a rectangle in PDF page coordinate.
[in]dstRectPointer to a FSCRT_RECT structure which is a rectangle in device coordinate.
[in]rotationRotation value for parameter srcRect to map dstRect. Please refer to macro definitions FSCRT_PAGEROTATION_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter matrix or srcRect or dstRect is a NULL pointer, or rotation is an invalid value.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
This is a helper function to get a transformation matrix from PDF page coordinate to device coordinate.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_CalcContentBBox ( FSCRT_PAGE  page,
FS_INT32  mode,
FSCRT_RECTF rectBBox 
)

Calculate content box rectangle in PDF page.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object. It should be a valid handle of PDF page that has been parsed.
[in]modeMode to calculate page margin. Please refer to macro definitions FSPDF_PAGEMARGIN_XXX and this should be one of these macros.
[out]rectBBoxPointer to a FSCRT_RECTF structure that receives the content box rectangle, in 1/72 inch. If there is any error, it will be [0 0 0 0].
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if any of five parameters page and rectBBox is a NULL pointer, or mode is invalid.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_NOTPARSED if parameter page has not been parsed.
FSCRT_ERRCODE_ERROR if fail to calculate content box rectangle in PDF page for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_Clear ( FSCRT_PAGE  page)

Release all page contents and related resources.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to release all page contents and related resources for any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Call this function to release page content objects and shared resources to save memory.
Clearing parameter page will not destroy page object, page object can be used again. And if it is reused again, call the clear function again.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_CountActions ( FSCRT_PAGE  page,
FS_INT32  trigger,
FS_INT32 count 
)

Count trigger actions of a PDF page.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]triggerThe page trigger type. Please refer to macro definitions FSPDF_TRIGGER_PAGE_XXX and this should be one of these macros.
[out]countPointer to a FS_INT32 object that receives the count of the page actions. If there is any error, it will be 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or count is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to count trigger actions of a PDF page for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_Create ( FSCRT_DOCUMENT  document,
FS_INT32  index,
FSCRT_PAGE *  page 
)

Create a new page to a position specified by the index.

Parameters
[in]documentValid handle to a FSCRT_DOCUMENT object which is a PDF document object.
[in]indexA zero-based index which specifies the position of the created page in PDF document.
Range: 0 to (pagecount-1). pagecount is returned by function FSPDF_Doc_CountPages.
If this is out of range, the new page will be added to the end in PDF document.
[out]pagePointer to a FSCRT_PAGE handle that receives a handle of the newly created page. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if any of two parameters document or page is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter document is not a valid PDF document type.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or creating PDF page is not allowed.
FSCRT_ERRCODE_DATANOTREADY if the data of parameter document is not ready when document is returned by function FSPDF_Doc_AsyncLoad.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if fail to create a new PDF page for any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • document: this handle is long-term partially recoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_Delete ( FSCRT_PAGE  page)

Delete a page from document.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter pageis a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or deleting PDF page is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if fail to delete a PDF page for any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it to process same objects between multi-threads, or the application should maintain thread safety when it needs to process same objects under multi-threaded environments.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_DoJavaScriptAction ( FSCRT_PAGE  page,
FS_INT32  trigger 
)

Perform the page javascript which is specified by the trigger.

Parameters
[in]pageHandle to a FSCRT_PAGE object which is a document object. It should be valid.
[in]triggerThe type of the trigger event. Please refer to macro definitions FSPDF_TRIGGER_PAGE_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_ERROR if fail to perform the page javascript action for any other reason.
FSCRT_ERRCODE_NOTFOUND if no suitable action is found.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_EstimateContentSize ( FSCRT_PAGE  page,
FS_DWORD contentSize 
)

Estimate the size of PDF page content.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[out]contentSizePointer to a FS_DWORD object to receive the content size. If there is any error, it will be 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or contentSize is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to estimate size of page content for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_Flatten ( FSCRT_PAGE  page,
FS_DWORD  flags 
)

Flatten a PDF page, and annotations or form fields will be made to be a part of the page contents.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]flagsThe flatten option. Please refer to macro definitions FSPDF_FLATTENFLAG_XXX and this should be one or combination of these macros.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page is a NULL pointer, or flags out of range.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or flattening is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if fail to flatten a PDF page for any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
Callers can use FSPDF_FLATTENFLAG_NOANNOT or FSPDF_FLATTENFLAG_NOFORMCONTROL to flatten a PDF page without annotations or forms, however, It will do nothing if flags FSPDF_FLATTENFLAG_NOANNOT is combined with FSPDF_FLATTENFLAG_NOFORMCONTROL.
After flattening a PDF page, callers should re-parse this page.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_GetAction ( FSCRT_PAGE  page,
FS_INT32  trigger,
FS_INT32  index,
FSPDF_ACTIONDATA actionData 
)

Get a trigger action of a PDF page.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]triggerThe page trigger type. Please refer to macro definitions FSPDF_TRIGGER_PAGE_XXX and this should be one of these macros.
[in]indexIndex of trigger action. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Page_CountActions.
[out]actionDataPointer to a FSPDF_ACTIONDATA structure that receives the page action.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or actionData is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_NOTFOUND if parameter index is out of range or no action is found.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_ERROR if fail to get a trigger actions of a PDF page for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_GetBox ( FSCRT_PAGE  page,
FS_INT32  boxType,
FSCRT_RECTF pageBox 
)

Get page boundary which is a rectangle type value.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]boxTypePage boundary type to a FS_INT32 value. Please refer to macro definitions FSPDF_PAGEBOX_XXX and this should be one of these macros.
[out]pageBoxPointer to a FSCRT_RECTF structure that receives a rectangle value. If there is any error, it will be set [0 0 0 0].
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or pageBox is a NULL pointer, or boxType is invalid.
FSCRT_ERRCODE_NOTFOUND if no suitable page boundary can be found.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to get page boundary for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
In PDF, coordinates of page is upward to Y-axis and rightward to X-axis, so left is less than right and top is greater than bottom.
The location of origin of coordinate is at the corner of bottom-left of page, and page unit is 1/72 inch.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_GetDict ( FSCRT_PAGE  page,
FSPDF_OBJECT *  dictionary 
)

Get the PDF page dictionary object.

Parameters
[in]pageHandle to a FSCRT_PAGE object which is a PDF page object.
[out]dictionaryPointer to a FSPDF_OBJECT handle that receives the page dictionary object. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or dictionary is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if the dictionary object of PDF page cannot be obtained for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is not thread safe. Do not call it for the same objects under multi-threaded environment;otherwise, the application should be synchronized.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
  • dictionary: this handle is short-term.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_GetIndex ( FSCRT_PAGE  page,
FS_INT32 index 
)

Get page index.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[out]indexPointer to a FS_INT32 object that receives page index which starts from 0. If there is any error, it will be set -1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or index is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_GetMatrix ( FSCRT_PAGE  page,
FS_INT32  x,
FS_INT32  y,
FS_INT32  width,
FS_INT32  height,
FS_INT32  rotation,
FSCRT_MATRIX matrix 
)

Get page transformation matrix.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]xLeft position of the transformation area in device coordinate, a FS_INT32 value, commonly in pixels.
[in]yTop position of the transformation area in device coordinate, a FS_INT32 value, commonly in pixels.
[in]widthWidth of the transformation area in device coordinate, a FS_INT32 value, commonly in pixels.
[in]heightHeight of the transformation area in device coordinate, a FS_INT32 value, commonly in pixels.
[in]rotationPage rotation value. Please refer to macro definitions FSCRT_PAGEROTATION_XXX and this should be one of these macros.
[out]matrixPointer to a FSCRT_MATRIX structure that receives the transformation matrix. If there is any error, it will be [1 0 0 1 0 0].
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or matrix is a NULL pointer, or rotation is an invalid value.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if fail to get page matrix for any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
The location of origin of coordinate is at the corner of bottom-left of page, and page unit is 1/72 inch.
Transformation matrix is used to transform PDF page coordinate to device coordinate. Call function FSCRT_Matrix_GetReverse to get a reversed matrix to transform to opposite direction.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_GetRotation ( FSCRT_PAGE  page,
FS_INT32 rotation 
)

Get page rotation.

Page size is the size of PDF page when value of "/Rotate" in page dictionary is 0.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[out]rotationPointer to a FS_INT32 object that receives page rotation state. Please refer to macro definitions FSCRT_PAGEROTATION_XXX and this would be one of these macros.
Default: FSCRT_PAGEROTATION_0.
If there is any error, it will be set -1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or rotation is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to get page rotation for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_GetSize ( FSCRT_PAGE  page,
FS_FLOAT width,
FS_FLOAT height 
)

Get page size.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[out]widthPointer to a FS_FLOAT object that receives page width, and unit is 1/72 inch. If there is any error, it will be set 0.
[out]heightPointer to a FS_FLOAT object that receives page height, and unit is 1/72 inch. If there is any error, it will be set 0.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or width or height is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_GetThumbnail ( FSCRT_PAGE  page,
FSCRT_BITMAP *  thumbnail 
)

Get the thumbnail bitmap from a page.

Parameters
[in]pageHandle to a FSCRT_PAGE object which is a PDF page. It should be valid.
[out]thumbnailPointer to a handle of FSCRT_BITMAP object that receives the thumbnail bitmap.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page or thumbnail is a NULL pointer.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or getting thumbnail is not allowed.
FSCRT_ERRCODE_NOTFOUND if a PDF page doesn't have a thumbnail bitmap.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a PDF page.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
The format of thumbnail bitmap can be FSCRT_BITMAPFORMAT_24BPP_BGR or FSCRT_BITMAPFORMAT_1BPP_RGB
Attention
Thread Safety: this function is thread safe. OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_HasTransparency ( FSCRT_PAGE  page,
FS_BOOL hasTransparency 
)

Check whether a PDF page has transparency.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object. It should be a valid handle of PDF page that has been parsed.
[out]hasTransparencyPointer to a FS_BOOL object that receives a boolean value which indicates whether page has transparency:
  • TRUE: parameter page has transparency.
  • FALSE: parameter page has no transparency..
If there is any error, it will be set FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or hasTransparency is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_NOTPARSED if parameter page has not been parsed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if fail to check whether a PDF page has transparency for any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_InsertAction ( FSCRT_PAGE  page,
FS_INT32  trigger,
FS_INT32  index,
const FSPDF_ACTIONDATA actionData 
)

Insert a page trigger action.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]triggerThe page trigger type. Please refer to macro definitions FSPDF_TRIGGER_PAGE_XXX and this should be one of these macros.
[in]indexZero-base index, where action will be inserted. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Page_CountActions.
If it is out of range or no action found, the actionData will be inserted to the last.
[in]actionDataPointer to a FSPDF_ACTIONDATA structure which to be inserted.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page, actionData or FSPDF_ACTIONDATA::actionDatais a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or inserting page action is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to insert page action for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_IsParsed ( FSCRT_PAGE  page,
FS_BOOL isParsed 
)

Determine whether page has been parsed or not.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[out]isParsedPointer to a FS_BOOL object that receives the current page parsing state:
  • TRUE: parameter page has been parsed.
  • FALSE: parameter page has not been parsed..
If there is any error, it will be set FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if parameter page or isParsed is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_RemoveAction ( FSCRT_PAGE  page,
FS_INT32  trigger,
FS_INT32  index 
)

Remove a page trigger action.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
Returned by function FSPDF_Doc_GetPage or FSPDF_Page_Create.
[in]triggerThe page trigger type. Please refer to macro definitions FSPDF_TRIGGER_PAGE_XXX and this should be one of these macros.
[in]indexindex of trigger action which is to be removed. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Page_CountActions.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or removing page action is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_NOTFOUND if parameter index is out of range or no action is found.
FSCRT_ERRCODE_ERROR if fail to remove page action for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_RemoveAllActions ( FSCRT_PAGE  page,
FS_INT32  trigger 
)

Remove all trigger actions of a PDF page.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
Returned by function FSPDF_Doc_GetPage or FSPDF_Page_Create.
[in]triggerThe page trigger type. Please refer to macro definitions FSPDF_TRIGGER_PAGE_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page is a NULL pointer, or trigger is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or removing all actions of a PDF page is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_NOTFOUND if no action of PDF page is found.
FSCRT_ERRCODE_ERROR if fail to remove all actions of a PDF page for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_SetAction ( FSCRT_PAGE  page,
FS_INT32  trigger,
FS_INT32  index,
const FSPDF_ACTIONDATA actionData 
)

Set a page trigger action.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]triggerThe page trigger type. Please refer to macro definitions FSPDF_TRIGGER_PAGE_XXX and this should be one of these macros.
[in]indexIndex of trigger action. Range: 0 to (actioncount-1). actioncount is returned by function FSPDF_Page_CountActions.
[in]actionDataPointer to a FSPDF_ACTIONDATA structure to be set.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page or actionData is a NULL pointer, or actionData is empty, or any member of FSPDF_ACTIONDATA::actionData is invalid, or trigger is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting page action is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_NOTFOUND if parameter index is out of range or no action is found.
FSCRT_ERRCODE_ERROR if fail to set page action for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_SetBox ( FSCRT_PAGE  page,
FS_INT32  boxType,
const FSCRT_RECTF pageBox 
)

Set page box which is a rectangle type of value.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]boxTypePage box to a FS_INT32 value. Please refer to macro definitions FSPDF_PAGEBOX_XXX and this should be one of these macros.
[in]pageBoxPointer to a FSCRT_RECTF structure to be set. It should be valid in PDF page coordinate: left value should always be smaller than right value, and bottom value should always be smaller than top value.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page or pageBox is a NULL pointer, or parameter boxType, pageBox is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting page box rectangle is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to set page box for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_SetClipRect ( FSCRT_PAGE  page,
const FSCRT_RECTF clipRect 
)

Set clip rectangle for all page objects on PDF page.

It will save time to set all page objects clip rectangle, and no need to call function FSPDF_PageObject_SetClipRect for every page object. After this function finishes successfully, please call function FSPDF_Page_StartParse again to re-parse the PDF page.

Parameters
[in]pageHandle to a FSCRT_PAGE object which is a PDF page. It should be valid.
[in]clipRectPointer to a FSCRT_RECTF structure for clip rectangle which is to be set to all page objects. It should be valid in PDF page coordinate: left value should always be smaller than right value, and bottom value should always be smaller than top value.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page or clipRect is a NULL pointer, or clipRect is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting page objects clip rectangle is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a PDF page.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_SetIndex ( FSCRT_PAGE  page,
FS_INT32  index 
)

Change page index of a PDF page.

To change page index is just like moving specific PDF page to a new place in current PDF document. So, indexes of PDF pages between old and new index of specific PDF page will also be changed as well.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]indexNew index of page.Range: 0 to (pagecount-1). pagecount is returned by function FSPDF_Doc_CountPages.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page is a NULL pointer or index is out of range.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting page index is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to change page index of a PDF page for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_SetRotation ( FSCRT_PAGE  page,
FS_INT32  rotation 
)

Set page rotation.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]rotationAn integer value for page rotation state. Please refer to macro definitions FSCRT_PAGEROTATION_XXX and this should be one of these macros.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page is a NULL pointer, or rotation is invalid.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting page rotation is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to set page rotation for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_SetSize ( FSCRT_PAGE  page,
FS_FLOAT  width,
FS_FLOAT  height 
)

Set page size.

New page size should be greater than 0, and cannot be greater than the original one. But for the newly created page (by function FSPDF_Page_Create),it can be set with any valid size,

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]widthA FS_FLOAT value for page width, unit is 1/72 inch.
[in]heightA FS_FLOAT value for page height, unit is 1/72 inch.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page is a NULL pointer, or width or height is not greater than 0, or width or height is greater than original value when page is loaded, not created by function FSPDF_Page_Create.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting page size is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to set page size for any other reason.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_SetThumbnail ( FSCRT_PAGE  page,
FSCRT_BITMAP  thumbnail 
)

Set a thumbnail bitmap to a page.

Thumbnail image does not use alpha channel. So user is recommended to set a bitmap without alpha channel to be the new thumbnail image. If a bitmap with alpha channel is set, the new thumbnail will use white background by default.

Parameters
[in]pageHandle to a FSCRT_PAGE object which is a PDF page. It should be valid.
[in]thumbnailHandle to a FSCRT_BITMAP object which is a bitmap. It should be valid.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page or thumbnail is a NULL pointer.
FSCRT_ERRCODE_UNSUPPORTED if parameter thumbnail is unsupported format: FSCRT_BITMAPFORMAT_16BPP_RGB565 and FSCRT_BITMAPFORMAT_8BPP_MASK.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or setting a thumbnail bitmap is not allowed.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a PDF page.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe. OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
  • thumbnail: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_StartParse ( FSCRT_PAGE  page,
FS_DWORD  flag,
FSCRT_PROGRESS *  parseProgress 
)

Start parsing a PDF page.

It will take a long time to parse a page with large contents, so Foxit PDF SDK uses a progressive process to do this.
Caller should pass parseProgress to function FSCRT_Progress_Continue to continue parsing in steps, Call function FSCRT_Progress_Release to destroy parseProgress object if parsing process is done.
All page content objects will be loaded after page is parsed.

Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]flagPage parsing mode: FSPDF_PAGEPARSEFLAG_NORMAL for normal mode, or FSPDF_PAGEPARSEFLAG_TEXTONLY for text-only mode.
[out]parseProgressPointer to a FSCRT_PROGRESS handle that receives a handle of progressive process. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_FINISHED if parameter page has been parsed over.
FSCRT_ERRCODE_PARAM if parameter page or parseProgress is a NULL pointer, or parameter flag is invalid.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_ERROR if fail to start parsing a PDF page for any other reason.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
To execute any page content related process, page should be parsed at first, for example, call function FSPDF_Page_CalcContentBBox to get content rect, call function FSPDF_RenderContext_StartPage to render page, or call page objects accessing functions.
It is very important to call function FSPDF_Page_Clear to release all page content objects to save memory if page contents are unnecessary any more.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term recoverable.
  • page: this handle is long-term partially recoverable.
  • parseProgress: this handle is long-term recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_Page_Transform ( FSCRT_PAGE  page,
const FSCRT_MATRIX matrix,
FS_BOOL  needTransformClipPath 
)

Transform a PDF page, including the annotations and form fields on the page.

Note
This function only supports scaling and translating. and after this operation, the page should be reloaded to display expected content.
Parameters
[in]pageHandle to a valid FSCRT_PAGE object.
[in]matrixPointer to a FSCRT_MATRIX structure object.
[in]needTransformClipPathA FS_BOOL value which indicates whether to transform the page with clip rect or not.
Returns
FSCRT_ERRCODE_SUCCESS if successful.
FSCRT_ERRCODE_PARAM if parameter page is a NULL pointer, or matrix is NULL.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or transform a PDF page is not allowed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_ERROR if fail to transform a PDF page for any other reason.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • page: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.
FS_RESULT FSPDF_RenderContext_StartPage ( FSPDF_RENDERCONTEXT  pdfRenderContext,
FSCRT_RENDERER  renderer,
FSCRT_PAGE  page,
FS_INT32  flag,
FSCRT_PROGRESS *  renderProgress 
)

Start rendering a PDF page in a renderer with a PDF rendering context.

It will take a long time to render a page with complex or large contents, so Foxit PDF SDK uses a progressive process to do this.
Caller should pass parameter renderProgress to function FSCRT_Progress_Continue to continue rendering in steps, and call function FSCRT_Progress_Release to destroy renderProgress object if rendering process is done.

Parameters
[in]pdfRenderContextHandle to a FSPDF_RENDERCONTEXT object which is a PDF rendering context, created by function FSPDF_RenderContext_Create.
[in]rendererHandle to a FSCRT_RENDERER object which is a rendering engine, created by function FSCRT_Renderer_CreateOnBitmap or platform-dependednt renderer creating functions.
[in]pageHandle to a valid FSCRT_PAGE object. It should be a valid handle of PDF page that has been parsed.
[in]flagPage render flag to a FS_INT32 value. Please refer to macro definitions FSPDF_PAGERENDERFLAG_XXX and this should be one of these macros.
[out]renderProgressPointer to a FSCRT_PROGRESS handle that receives a handle of progressive process. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if any of four parameters pdfRenderContext, renderer, page and renderProgress is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if parameter page is not a type of PDF page.
FSCRT_ERRCODE_NOTPARSED if parameter page has not been parsed.
FSCRT_ERRCODE_UNRECOVERABLE if the function finds an unrecoverable error internally.
FSCRT_ERRCODE_OUTOFMEMORY if there is not enough memory or if the memory access is wrong.
For more error codes, please refer to macro definitions FSCRT_ERRCODE_XXX.
Note
To call this function, parameter page should be parsed. Please refer to function FSPDF_Page_StartParse for how to parse a page.
Attention
Thread Safety: this function is thread safe.
OOM Information:
OOM handling is only for mobile platforms, not for server or desktop.
  • This function is long-term unrecoverable.
  • pdfRenderContext: this handle is long-term recoverable.
  • renderer: this handle is long-term recoverable.
  • renderProgress: this handle is long-term partially recoverable.
Please refer to the document "Robust PDF Applications with Limited Memory" for more details.

Foxit Corporation