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...
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:
-
1. Asynchronous PDF access:
-
a. Load a remote PDF file as asynchronous document, retrieve the first page index and determine whether the file data is available.
-
b. Asynchronous PDF is a flexible way to access remote PDF easily. It is designed especially for PDF files from Internet. Users need not download a remote PDF file fully before accessing it. Only a few data may be enough to display a page. While retrieving a PDF document object, use the function FSPDF_Doc_IsDocAvail to determine whether the data of document level is ready. While displaying a PDF page object, use the function FSPDF_Doc_IsPageAvail to determine whether the data of a page level is ready. If the user wants to access PDF form, use the function FSPDF_Doc_IsFormAvail to determine whether the form is ready.
-
c. Note: while getting a PDF document object which is returned by the function FSPDF_Doc_AsyncLoad, it is not a full available object, call fucntion FSPDF_Doc_IsDocAvail to make sure it is available really.
Load PDF file in asynchronous mode.
In asynchronous mode, it only supports display but does not support edit for PDF linearized files.
- Parameters
-
[in] | asyncFile | Pointer to a FSPDF_ASYNCFILEHANDLER structure for accessing file data. |
[in] | password | Pointer 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] | document | Pointer 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] | document | Handle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid. |
[out] | pageIndex | Pointer 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.
Check whether the document is available.
If the document is not available, downloading the document should be continuous.
- Parameters
-
[in] | document | Handle to a FSCRT_DOCUMENT object returned by function FSPDF_Doc_AsyncLoad. |
[out] | isAvail | Pointer 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.
Check whether the form is available.
If the form is not available, downloading the form should be continuous.
- Parameters
-
[in] | document | Handle to a FSCRT_DOCUMENT object returned by function FSPDF_Doc_AsyncLoad. |
[out] | isAvail | Pointer 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] | document | Handle to a FSCRT_DOCUMENT object which is a PDF document object. It should be valid. |
[out] | linearizedState | Pointer 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.
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] | document | Handle to a FSCRT_DOCUMENT object returned by function FSPDF_Doc_AsyncLoad. |
[in] | pageIndex | A zero-based index of page which is to be checked. Range:0 to (pagecount-1). pagecount is returned by function FSPDF_Doc_CountPages. |
[out] | isAvail | Pointer 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.