Foxit PDF SDK
|
Classes | |
class | ClientInfo |
Structure that represents the client information which is used to apply for a client ID from ConnectedPDF server. More... | |
Public Types | |
enum | EncryptType { e_EncryptTypeAES = 1, e_EncryptTypeSM4CBC = 2 } |
Enumeration for encryption mode. More... | |
Public Member Functions | |
ConnectedPDF (const char *clientid, const char *user_token, const char *content_key, addon::ConnectedPDF::EncryptType type, const char *file_path) | |
Constructor, with parameters and from an existing PDF file path. More... | |
ConnectedPDF (const char *clientid, const char *user_token, const char *content_key, addon::ConnectedPDF::EncryptType type, const wchar_t *file_path) | |
Constructor, with parameters and from an existing PDF file path. More... | |
ConnectedPDF (const char *clientid, const char *user_token, const char *content_key, addon::ConnectedPDF::EncryptType type, foxit::common::file::ReaderCallback *file_read) | |
Constructor, with parameters and a common::file::ReaderCallback object. More... | |
ConnectedPDF (const foxit::String &clientid, const foxit::String &user_token, const foxit::String &content_key, addon::ConnectedPDF::EncryptType type, const foxit::pdf::PDFDoc &document) | |
Constructor, with parameters and a PDF document object. More... | |
ConnectedPDF (const ConnectedPDF &connected_pdf) | |
Constructor, with another ConnectedPDF object. More... | |
~ConnectedPDF () | |
Destructor function. | |
foxit::ErrorCode | ConvertToCDRM (const char *endpoint, const char *wrapper_path, const char *file_name) |
Convert the loaded document to a ConnectedPDF DRM document. More... | |
foxit::ErrorCode | ConvertToCDRM (const char *endpoint, const wchar_t *wrapper_path, const wchar_t *file_name) |
Convert the loaded document to a ConnectedPDF DRM document. More... | |
foxit::ErrorCode | ConvertToCDRM (const char *endpoint, foxit::common::file::ReaderCallback *wrapper_file_read, const char *file_name) |
Convert the loaded document to a ConnectedPDF DRM document. More... | |
foxit::ErrorCode | ConvertToCDRM (const char *endpoint, foxit::common::file::ReaderCallback *wrapper_file_read, const wchar_t *file_name) |
Convert the loaded document to a ConnectedPDF DRM document. More... | |
foxit::ErrorCode | ConvertToCPDF (const char *endpoint, const char *file_name) |
Convert the loaded document to a ConnectedPDF document. More... | |
foxit::ErrorCode | ConvertToCPDF (const char *endpoint, const wchar_t *file_name) |
Convert the loaded document to a ConnectedPDF document. More... | |
String | GetACL () |
Get ACL of a ConnectedPDF DRM document. More... | |
String | GetContentKey () |
Get the content key if the loaded document is a ConnectedPDF DRM document. More... | |
foxit::pdf::PDFDoc | GetDocument () |
Get the associated PDF document object. More... | |
String | GetDocURI () |
Get the ConnectedPDF document URI from the loaded document. More... | |
String | GetEndpoint () |
Get the ConnectedPDF document endpoint from the loaded document. More... | |
String | GetOwnerEmail () |
Get the ConnectedPDF document owner email. More... | |
String | GetOwnerName () |
Get the ConnectedPDF document owner name. More... | |
String | GetUserToken () |
Get the user token. More... | |
String | GetVersionID () |
Get the ConnectedPDF document version ID from the loaded document. More... | |
bool | IsCDRM () |
Check whether the loaded document is a ConnectedPDF DRM document or not. More... | |
bool | IsCPDF () |
Check whether the loaded document is a ConnectedPDF document or not. More... | |
bool | IsEmpty () const |
Check whether current object is empty or not. More... | |
bool | IsOwner () |
Check whether current user is the owner. More... | |
bool | operator!= (const ConnectedPDF &other) const |
Not equal operator. More... | |
ConnectedPDF & | operator= (const ConnectedPDF &other) |
Assign operator. More... | |
bool | operator== (const ConnectedPDF &other) const |
Equal operator. More... | |
String | RefreshVersionID () |
Refresh the ConnectedPDF document version ID from the loaded document. More... | |
foxit::ErrorCode | RemoveCDRM () |
Remove the ConnectedPDF DRM protection of a ConnectedPDF document. More... | |
bool | SaveAs (const char *file_path) |
Save the current ConnectedPDF document as another PDF file. More... | |
bool | SaveAs (foxit::common::file::WriterCallback *file_write) |
Save the current ConnectedPDF document as another PDF file. More... | |
foxit::ErrorCode | SetACL (const String &acl) |
Set ACL of a ConnectedPDF DRM document. More... | |
void | SetUserToken (const String &user_token) |
Set the user token to switch it. More... | |
![]() | |
FS_HANDLE | Handle () const |
Get the handle of current object. More... | |
Static Public Member Functions | |
static String | GetClientIDFromServer (const char *endpoint, ClientInfo *client_info) |
Apply for a client id from ConnectedPDF server using the input client info. More... | |
static String | GetDocURI (const char *file_path) |
Get the ConnectedPDF document URI from the PDF path. More... | |
static String | GetUserTokenFromServer (const char *endpoint, const String &user_email, const String &password) |
Get the user token from ConnectedPDF server. More... | |
Class ConnectedPDF offers following functions,
foxit::addon::ConnectedPDF::ConnectedPDF | ( | const char * | clientid, |
const char * | user_token, | ||
const char * | content_key, | ||
addon::ConnectedPDF::EncryptType | type, | ||
const char * | file_path | ||
) |
Constructor, with parameters and from an existing PDF file path.
A ConnectedPDF object can be constructed to load a normal PDF document, or a ConnectedPDF document, or a ConnectedPDF DRM document. If current document is a normal PDF document, it can be converted to a ConnectedPDF document or a ConnectedPDF DRM document. If current document is a ConnectedPDF document, it can be convert to a ConnectedPDF DRM document.
[in] | clientid | A client ID whcih is created by function ConnectedPDF::GetClientIDFromServer. |
[in] | user_token | A user token is created by function ConnectedPDF::GetUserTokenFromServer. |
[in] | content_key | If the client has cached the content key, just input the cached key to decrypt ConnectedPDF DRM document. Otherwise, set content_key with an empty string, and ConnectedPDF object will apply for the content key from server. |
[in] | type | Encryption algorithm. Please refer to values starting from ConnectedPDF::e_EncryptTypeAES and this should be one of these values. |
[in] | file_path | A path of an existing PDF file. |
foxit::addon::ConnectedPDF::ConnectedPDF | ( | const char * | clientid, |
const char * | user_token, | ||
const char * | content_key, | ||
addon::ConnectedPDF::EncryptType | type, | ||
const wchar_t * | file_path | ||
) |
Constructor, with parameters and from an existing PDF file path.
A ConnectedPDF object can be constructed to load a normal PDF document, or a ConnectedPDF document, or a ConnectedPDF DRM document. If current document is a normal PDF document, it can be converted to a ConnectedPDF document or a ConnectedPDF DRM document. If current document is a ConnectedPDF document, it can be convert to a ConnectedPDF DRM document.
[in] | clientid | A client ID whcih is created by function ConnectedPDF::GetClientIDFromServer. |
[in] | user_token | A user token is created by function ConnectedPDF::GetUserTokenFromServer. |
[in] | content_key | If the client has cached the content key, just input the cached key to decrypt ConnectedPDF DRM document. Otherwise, set content_key with an empty string, and ConnectedPDF object will apply for the content key from server. |
[in] | type | Encryption algorithm. Please refer to values starting from ConnectedPDF::e_EncryptTypeAES and this should be one of these values. |
[in] | file_path | A path of an existing PDF file. |
foxit::addon::ConnectedPDF::ConnectedPDF | ( | const char * | clientid, |
const char * | user_token, | ||
const char * | content_key, | ||
addon::ConnectedPDF::EncryptType | type, | ||
foxit::common::file::ReaderCallback * | file_read | ||
) |
Constructor, with parameters and a common::file::ReaderCallback object.
A ConnectedPDF object can be constructed to load a normal PDF document, or a ConnectedPDF document, or a ConnectedPDF DRM document. If current document is a normal PDF document, it can be converted to a ConnectedPDF document or a ConnectedPDF DRM document. If current document is a ConnectedPDF document, it can be convert to a ConnectedPDF DRM document.
[in] | clientid | A client ID whcih is created by function ConnectedPDF::GetClientIDFromServer. |
[in] | user_token | A user token is created by function ConnectedPDF::GetUserTokenFromServer. |
[in] | content_key | If the client has cached the content key, just input the cached key to decrypt ConnectedPDF DRM document. Otherwise, set content_key with an empty string, and ConnectedPDF object will apply for the content key from server. |
[in] | type | Encryption algorithm. Please refer to values starting from ConnectedPDF::e_EncryptTypeAES and this should be one of these values. |
[in] | file_read | A common::file::ReaderCallback object which is implemented by user to load a PDF document. It should not be NULL. |
foxit::addon::ConnectedPDF::ConnectedPDF | ( | const foxit::String & | clientid, |
const foxit::String & | user_token, | ||
const foxit::String & | content_key, | ||
addon::ConnectedPDF::EncryptType | type, | ||
const foxit::pdf::PDFDoc & | document | ||
) |
Constructor, with parameters and a PDF document object.
The constructed ConnectedPDF object can be converted to a ConnectedPDF document or a ConnectedPDF DRM document.
[in] | clientid | A client ID whcih is created by function ConnectedPDF::GetClientIDFromServer. |
[in] | user_token | A user token is created by function ConnectedPDF::GetUserTokenFromServer. |
[in] | content_key | If the client has cached the content key, just input the cached key to decrypt ConnectedPDF DRM document. Otherwise, set content_key as NULL, and ConnectedPDF object will apply for the content key from server. |
[in] | type | Encryption algorithm. Please refer to values starting from ConnectedPDF::e_EncryptTypeAES and this should be one of these values. |
[in] | document | A valid PDF document object which represents a normal PDF document. |
foxit::addon::ConnectedPDF::ConnectedPDF | ( | const ConnectedPDF & | connected_pdf | ) |
Constructor, with another ConnectedPDF object.
[in] | connected_pdf | Another ConnectedPDF object |
foxit::ErrorCode foxit::addon::ConnectedPDF::ConvertToCDRM | ( | const char * | endpoint, |
const char * | wrapper_path, | ||
const char * | file_name | ||
) |
Convert the loaded document to a ConnectedPDF DRM document.
When the loaded document is converted to a ConnectedPDF DRM document, please use function ConnectedPDF::SaveAs to save it.
[in] | endpoint | The input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com. |
[in] | wrapper_path | A path of an existing PDF file. |
[in] | file_name | The file name used by ConnectedPDF server. If this is an empty string, "Unknown.pdf" will be used as the file name by default |
foxit::ErrorCode foxit::addon::ConnectedPDF::ConvertToCDRM | ( | const char * | endpoint, |
const wchar_t * | wrapper_path, | ||
const wchar_t * | file_name | ||
) |
Convert the loaded document to a ConnectedPDF DRM document.
When the loaded document is converted to a ConnectedPDF DRM document, please use function ConnectedPDF::SaveAs to save it.
[in] | endpoint | The input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com. |
[in] | wrapper_path | A path of an existing PDF file. |
[in] | file_name | The file name used by ConnectedPDF server. If this is an empty string, "Unknown.pdf" will be used as the file name by default |
foxit::ErrorCode foxit::addon::ConnectedPDF::ConvertToCDRM | ( | const char * | endpoint, |
foxit::common::file::ReaderCallback * | wrapper_file_read, | ||
const char * | file_name | ||
) |
Convert the loaded document to a ConnectedPDF DRM document.
When the loaded document is converted to a ConnectedPDF DRM document, please use function ConnectedPDF::SaveAs to save it.
[in] | endpoint | The input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com. |
[in] | wrapper_file_read | A common::file::ReaderCallback object which is implemented by user to save a PDF document. |
[in] | file_name | The file name used by ConnectedPDF server. If this is an empty string, "Unknown.pdf" will be used as the file name by default |
foxit::ErrorCode foxit::addon::ConnectedPDF::ConvertToCDRM | ( | const char * | endpoint, |
foxit::common::file::ReaderCallback * | wrapper_file_read, | ||
const wchar_t * | file_name | ||
) |
Convert the loaded document to a ConnectedPDF DRM document.
When the loaded document is converted to a ConnectedPDF DRM document, please use function ConnectedPDF::SaveAs to save it.
[in] | endpoint | The input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com. |
[in] | wrapper_file_read | A common::file::ReaderCallback object which is implemented by user to save a PDF document. |
[in] | file_name | The file name used by ConnectedPDF server. If this is an empty string, "Unknown.pdf" will be used as the file name by default |
foxit::ErrorCode foxit::addon::ConnectedPDF::ConvertToCPDF | ( | const char * | endpoint, |
const char * | file_name | ||
) |
Convert the loaded document to a ConnectedPDF document.
When the loaded document is converted to a ConnectedPDF document, please use function ConnectedPDF::SaveAs to save it.
[in] | endpoint | The input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com. |
[in] | file_name | The file name used by ConnectedPDF server. If this is an empty string, "Unknown.pdf" will be used as the file name by default |
foxit::ErrorCode foxit::addon::ConnectedPDF::ConvertToCPDF | ( | const char * | endpoint, |
const wchar_t * | file_name | ||
) |
Convert the loaded document to a ConnectedPDF document.
When the loaded document is converted to a ConnectedPDF document, please use function ConnectedPDF::SaveAs to save it.
[in] | endpoint | The input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com. |
[in] | file_name | The file name used by ConnectedPDF server. If this is an empty string, "Unknown.pdf" will be used as the file name by default |
String foxit::addon::ConnectedPDF::GetACL | ( | ) |
Get ACL of a ConnectedPDF DRM document.
The owner can get all the user's ACL; otherwise, the current user can get its own ACL. If the loaded document is not a ConnectedPDF DRM document, this function will throw exception foxit::e_ErrNotCDRM.
[ { Control the specified pages to be hidden. "accessPages" : { The page indexes to be hidden. For example, [ 1, [2,10],12 ]. "Pages" : [], The content cover over the hidden pages. "wrapperContent" : null, The picture cover over the hidden pages. Cannot support now. Just leave it empty. "wrapperPic" : null }, The PDF standard permission array. The value is hex. The values can be 4,8,10,20,100,200,400,800. Please refer to values starting from for more information. "decodePermission" : [ 8, 10 ], Limit device to open the document. "deviceLimit" : { The devices has opened the document. "appList" : [], No more device can open the document. "isLimit" : 0, The permitted device count to open the document. "limitNum" : 0 }, Whether the ACL is for everyone or not. "everyone" : 0, Whether the user has full control permission. "fullControl" : 0, The grout ID. "groupID" : "", The grout name. "groupName" : "", Whether the ACL is for a group or not. "isGroup" : 0, Whether the ACL has been revoked. "isRevoke" : 0, Whether the user can open the document offline. 0=Never 1=By Days 2=Always. "offline" : 0, The permitted offline days. "offlineDuration" : 0, Whether set the online expiration date. 0=Never 1=By Days 2=By Date. "online" : 0, Expiration date. For example, "2017-01-01 01:59:59". "onlineDuration" : "", Expiration days. "onlineDurationDays" : 0, The PDF standard permission. The value is decimal. It's the combination of the hex values 4,8,10,20,100,200,400,800. Please refer to values starting from for more information. "permission" : 312, The user info. "userAttribute" : { The domain the user belongs to. "Domain" : "", The user ID. "cUserID" : "58197659c2dcf1c7143febce", The user email. "userEmail" : "65908769@qq.com" } } ]
|
static |
Apply for a client id from ConnectedPDF server using the input client info.
The client id represents a ConnectedPDF client running on a device. The client ID is used to create a ConnectedPDF object. It is required for converting normal PDF to ConnectedPDF. The client should apply for a client id once, then cache it and reuse it. This function may throw exception foxit::e_ErrCanNotConnectToServer.
[in] | endpoint | The input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com. |
[in] | client_info | The input client information used to apply for a client id from ConnectedPDF server. |
String foxit::addon::ConnectedPDF::GetContentKey | ( | ) |
Get the content key if the loaded document is a ConnectedPDF DRM document.
foxit::pdf::PDFDoc foxit::addon::ConnectedPDF::GetDocument | ( | ) |
Get the associated PDF document object.
The returned PDF document object can be edited. If the loaded document is a ConnectedPDF DRM document, user should save it by function ConnectedPDF::SaveAs; otherwise, the saved document will be corrupted.
|
static |
Get the ConnectedPDF document URI from the PDF path.
Every ConnectedPDF document or ConnectedPDF DRM document has the document URI. It is the unique identification of the ConnectedPDF document or ConnectedPDF DRM document.
[in] | file_path | A path of an existing PDF file. |
String foxit::addon::ConnectedPDF::GetDocURI | ( | ) |
Get the ConnectedPDF document URI from the loaded document.
String foxit::addon::ConnectedPDF::GetEndpoint | ( | ) |
Get the ConnectedPDF document endpoint from the loaded document.
String foxit::addon::ConnectedPDF::GetOwnerEmail | ( | ) |
Get the ConnectedPDF document owner email.
String foxit::addon::ConnectedPDF::GetOwnerName | ( | ) |
Get the ConnectedPDF document owner name.
String foxit::addon::ConnectedPDF::GetUserToken | ( | ) |
Get the user token.
|
static |
Get the user token from ConnectedPDF server.
A user token should be gotten before accessing ConnectedPDF web service. The client can get the user token once, then cache it and reuse it. This function may throw exception foxit::e_ErrCanNotConnectToServer.
[in] | endpoint | The input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com. |
[in] | user_email | The input user email. |
[in] | password | The input user password. |
String foxit::addon::ConnectedPDF::GetVersionID | ( | ) |
Get the ConnectedPDF document version ID from the loaded document.
bool foxit::addon::ConnectedPDF::IsCDRM | ( | ) |
Check whether the loaded document is a ConnectedPDF DRM document or not.
bool foxit::addon::ConnectedPDF::IsCPDF | ( | ) |
Check whether the loaded document is a ConnectedPDF document or not.
bool foxit::addon::ConnectedPDF::IsEmpty | ( | ) | const |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
bool foxit::addon::ConnectedPDF::IsOwner | ( | ) |
Check whether current user is the owner.
bool foxit::addon::ConnectedPDF::operator!= | ( | const ConnectedPDF & | other | ) | const |
Not equal operator.
Not equal operator.
[in] | other | Another ConnectedPDF object. This function will check if current object is not equal to this one. |
ConnectedPDF& foxit::addon::ConnectedPDF::operator= | ( | const ConnectedPDF & | other | ) |
Assign operator.
[in] | other | Another ConnectedPDF object, whose value would be assigned to current object. |
bool foxit::addon::ConnectedPDF::operator== | ( | const ConnectedPDF & | other | ) | const |
Equal operator.
[in] | other | Another ConnectedPDF object. This function will check if current object is equal to this one. |
String foxit::addon::ConnectedPDF::RefreshVersionID | ( | ) |
Refresh the ConnectedPDF document version ID from the loaded document.
foxit::ErrorCode foxit::addon::ConnectedPDF::RemoveCDRM | ( | ) |
Remove the ConnectedPDF DRM protection of a ConnectedPDF document.
Only the owner has the permission to remove the ConnectedPDF DRM protection. When the ConnectedPDF DRM protection is removed, function ConnectedPDF::SaveAs can be used to save it.
bool foxit::addon::ConnectedPDF::SaveAs | ( | const char * | file_path | ) |
Save the current ConnectedPDF document as another PDF file.
If the loaded document is a ConnectedPDF DRM document, the document can be saved as only by this funcction; otherwise the saved document will be corrupted.
[in] | file_path | A path for the new saved PDF file. It should not be an empty string. |
bool foxit::addon::ConnectedPDF::SaveAs | ( | foxit::common::file::WriterCallback * | file_write | ) |
Save the current ConnectedPDF document as another PDF file.
If the loaded document is a ConnectedPDF DRM document, the document can be saved as only by this funcction; otherwise the saved document will be corrupted.
[in] | file_write | A common::file::WriterCallback object which is implemented by user to do the saving. |
foxit::ErrorCode foxit::addon::ConnectedPDF::SetACL | ( | const String & | acl | ) |
Set ACL of a ConnectedPDF DRM document.
Only the owner has the permission to set ACL. This function will revoke all the ACL of the ConnectedPDF DRM document first, and then apply the new ACL.
void foxit::addon::ConnectedPDF::SetUserToken | ( | const String & | user_token | ) |
Set the user token to switch it.
[in] | user_token | The input user token. |