PDF Async

Definitions for asynchronous access to PDF document.
Definitions and functions in this module are included in fpdf_async_r.h.
Module: PDFAsync
License Identifier: Async/All
Available License Right: Reading. More...

Classes

struct  FSPDF_ASYNCFILEHANDLER
 Structure for receiving download hints. More...
 

Functions

FS_RESULT FSPDF_Doc_AsyncLoad (FSPDF_ASYNCFILEHANDLER *asyncFile, const FSCRT_BSTR *password, FSCRT_DOCUMENT *document)
 Load PDF file in asynchronous mode. More...
 
FS_RESULT FSPDF_Doc_IsLinearized (FSCRT_DOCUMENT document, FS_INT32 *linearizedState)
 Check if the asynchronous file is a linearized PDF and get the linearized state. More...
 
FS_RESULT FSPDF_Doc_GetFirstAvailPageIndex (FSCRT_DOCUMENT document, FS_INT32 *pageIndex)
 Get the page index of first available page in a linearized PDF. More...
 
FS_RESULT FSPDF_Doc_IsDocAvail (FSCRT_DOCUMENT document, FS_BOOL *isAvail)
 Check whether the document is available. More...
 
FS_RESULT FSPDF_Doc_IsPageAvail (FSCRT_DOCUMENT document, FS_INT32 pageIndex, FS_BOOL *isAvail)
 Check whether the page is available. More...
 
FS_RESULT FSPDF_Doc_IsFormAvail (FSCRT_DOCUMENT document, FS_BOOL *isAvail)
 Check whether the form is available. More...
 

Macro Definitions for PDF Document Linearized State.

Note
Linearized state indicates whether a PDF document is a linearized file or not.
#define FSPDF_DOC_LINEARIZED_YES   1
 PDF document is a linearized file.
 
#define FSPDF_DOC_LINEARIZED_NO   0
 PDF document is not a linearized file.
 
#define FSPDF_DOC_LINEARIZED_UNKNOW   -1
 Do not know whether PDF document is a linearize file or not.
 

Detailed Description

Definitions for asynchronous access to PDF document.
Definitions and functions in this module are included in fpdf_async_r.h.
Module: PDFAsync
License Identifier: Async/All
Available License Right: Reading.

This module contains following features:

Function Documentation

FS_RESULT FSPDF_Doc_AsyncLoad ( FSPDF_ASYNCFILEHANDLER asyncFile,
const FSCRT_BSTR password,
FSCRT_DOCUMENT *  document 
)

Load PDF file in asynchronous mode.

In asynchronous mode, it only supports display but does not support edit for PDF linearized files.

Parameters
[in]asyncFilePointer to a FSPDF_ASYNCFILEHANDLER structure for accessing file data.
[in]passwordPointer to a FSCRT_BSTR structure which specifies password. It can be user password or owner one. If no password is used, use NULL. It should be a UTF-8 string if valid.
[out]documentPointer to a FSCRT_DOCUMENT handle that receives the PDF document object. If there is any error, it will be NULL.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter asyncFile or document is a NULL pointer, or FSPDF_ASYNCFILEHANDLER::GetFile is NYLL.
FSCRT_ERRCODE_INVALIDLICENSE if the current license is not authorized or load PDF document in asynchronous mode is not allowed.
FSCRT_ERRCODE_INVALIDMODULE if the PDF module is not initialized.
FSCRT_ERRCODE_FILE if cannot read data from parameter asyncFile.
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 failing to load a PDF file in asynchronous mode because of any other reason.
For more error codes, please refer to the macro definitions FSCRT_ERRCODE_XXX.
Note
For loading PDF file in asynchronous mode, FSPDF_ASYNCFILEHANDLER::GetFile should be implemented by application.
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.
  • 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_Doc_GetFirstAvailPageIndex ( FSCRT_DOCUMENT  document,
FS_INT32 pageIndex 
)

Get the page index of first available page in a linearized PDF.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]pageIndexPointer to a FS_INT32 object that receives the index of the first available page. If there is any error, it will be set -1.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or pageIndex is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a type of PDF document.
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_DATANOTREADY if there are not available data for ASYNC documents.
For more error codes, please refer to the 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.
  • 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_Doc_IsDocAvail ( FSCRT_DOCUMENT  document,
FS_BOOL isAvail 
)

Check whether the document is available.

If the document is not available, downloading the document should be continuous.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object returned by function FSPDF_Doc_AsyncLoad.
[out]isAvailPointer to a FS_BOOL object that receives whether the document is available.
  • TRUE: the document is available.
  • FALSE: the document is unavailable.
If there is any error, it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or isAvail is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a type of PDF document.
FSCRT_ERRCODE_FORMAT if the data format in document is not recognized.
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_DATANOTREADY if there is not available data for ASYNC documents.
For more error codes, please refer to the 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.
  • 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_Doc_IsFormAvail ( FSCRT_DOCUMENT  document,
FS_BOOL isAvail 
)

Check whether the form is available.

If the form is not available, downloading the form should be continuous.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object returned by function FSPDF_Doc_AsyncLoad.
[out]isAvailPointer to a FS_BOOL object that receives whether the form is available.
  • TRUE: the form is available or no forms in parameter document.
  • FALSE: the form is unavailable.
If there is any error, it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or isAvail is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a type of PDF document.
FSCRT_ERRCODE_NOTFOUND if there is no form in document; 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_DATANOTREADY if there is not available data for ASYNC documents.
For more error codes, please refer to the 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.
  • 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_Doc_IsLinearized ( FSCRT_DOCUMENT  document,
FS_INT32 linearizedState 
)

Check if the asynchronous file is a linearized PDF and get the linearized state.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid.
[out]linearizedStatePointer to a FS_INT32 object that receives an integer value that receives linearized state. Please refer to the macro definitions FSPDF_DOC_LINEARIZED_XXX and this would be one of these macros.
If there is any error, it will be FSPDF_DOC_LINEARIZED_UNKNOW.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or isLinearized is a NULL pointer.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a type of PDF document.
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_DATANOTREADY if there is not available data for ASYNC documents.
FSCRT_ERRCODE_ERROR if failing to check because of any other reason.
For more error codes, please refer to the 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.
  • 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_Doc_IsPageAvail ( FSCRT_DOCUMENT  document,
FS_INT32  pageIndex,
FS_BOOL isAvail 
)

Check whether the page is available.

If the page is not available, downloading the page should be continuous. This function can only be called after the document is available, which can be checked by function FSPDF_Doc_IsDocAvail.

Parameters
[in]documentHandle to a FSCRT_DOCUMENT object returned by function FSPDF_Doc_AsyncLoad.
[in]pageIndexA zero-based index of page which is to be checked. Range:0 to (pagecount-1). pagecount is returned by function FSPDF_Doc_CountPages.
[out]isAvailPointer to a FS_BOOL object that receives whether the page is available.
  • TRUE: the page is available.
  • FALSE: the page is unavailable.
If there is any error, it will be FALSE.
Returns
FSCRT_ERRCODE_SUCCESS for success.
FSCRT_ERRCODE_PARAM if the parameter document or isAvail is a NULL pointer, or pageIndex is out of range.
FSCRT_ERRCODE_INVALIDTYPE if the parameter document is not a type of PDF document.
FSCRT_ERRCODE_NOTFOUND if the parameter pageIndex is out of range.
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_DATANOTREADY if there is not available data for ASYNC documents.
For more error codes, please refer to the 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.

Foxit Corporation