com.foxit.sdk.addon.ConnectedPDF Class Reference
Inheritance diagram for com.foxit.sdk.addon.ConnectedPDF:
com.foxit.sdk.common.Base

Public Member Functions

 ConnectedPDF (String clientid, String user_token, String content_key, String file_path) throws com.foxit.sdk.PDFException
 Constructor, with parameters and from an existing PDF file path.
More...
 
 ConnectedPDF (String clientid, String user_token, String content_key, FileReaderCallback file_read) throws com.foxit.sdk.PDFException
 Constructor, with parameters and a ReaderCallback object.
More...
 
 ConnectedPDF (String clientid, String user_token, String content_key, PDFDoc document) throws com.foxit.sdk.PDFException
 Constructor, with parameters and a PDF document object.
More...
 
 ConnectedPDF (ConnectedPDF connected_pdf)
 Constructor, with another ConnectedPDF object.
More...
 
int convertToCDRM (String endpoint, String wrapper_path, String file_name) throws com.foxit.sdk.PDFException
 Convert the loaded document to a ConnectedPDF DRM document.
More...
 
int convertToCDRM (String endpoint, FileReaderCallback wrapper_file_read, String file_name) throws com.foxit.sdk.PDFException
 Convert the loaded document to a ConnectedPDF DRM document.
More...
 
int convertToCPDF (String endpoint, String file_name) throws com.foxit.sdk.PDFException
 Convert the loaded document to a ConnectedPDF document.
More...
 
String getACL () throws com.foxit.sdk.PDFException
 Get ACL of a ConnectedPDF DRM document.
More...
 
String getContentKey () throws com.foxit.sdk.PDFException
 Get the content key if the loaded document is a ConnectedPDF DRM document.
More...
 
PDFDoc getDocument () throws com.foxit.sdk.PDFException
 Get the associated PDF document object.
More...
 
String getDocURI () throws com.foxit.sdk.PDFException
 Get the ConnectedPDF document URI from the loaded document.
More...
 
String getEndpoint () throws com.foxit.sdk.PDFException
 Get the ConnectedPDF document endpoint from the loaded document.
More...
 
String getOwnerEmail () throws com.foxit.sdk.PDFException
 Get the ConnectedPDF document owner email.
More...
 
String getOwnerName () throws com.foxit.sdk.PDFException
 Get the ConnectedPDF document owner name.
More...
 
String getUserToken () throws com.foxit.sdk.PDFException
 Get the user token.
More...
 
String getVersionID () throws com.foxit.sdk.PDFException
 Get the ConnectedPDF document version ID from the loaded document.
More...
 
boolean isCDRM () throws com.foxit.sdk.PDFException
 Check whether the loaded document is a ConnectedPDF DRM document or not.
More...
 
boolean isCPDF () throws com.foxit.sdk.PDFException
 Check whether the loaded document is a ConnectedPDF document or not.
More...
 
boolean isEmpty ()
 Check whether current object is empty or not.
More...
 
boolean isOwner () throws com.foxit.sdk.PDFException
 Check whether current user is the owner.
More...
 
String refreshVersionID () throws com.foxit.sdk.PDFException
 Refresh the ConnectedPDF document version ID from the loaded document.
More...
 
int removeCDRM () throws com.foxit.sdk.PDFException
 Remove the ConnectedPDF DRM protection of a ConnectedPDF document.
More...
 
boolean saveAs (String file_path) throws com.foxit.sdk.PDFException
 Save the current ConnectedPDF document as another PDF file.
More...
 
boolean saveAs (FileWriterCallback file_write) throws com.foxit.sdk.PDFException
 Save the current ConnectedPDF document as another PDF file.
More...
 
int setACL (String acl) throws com.foxit.sdk.PDFException
 Set ACL of a ConnectedPDF DRM document.
More...
 
void setUserToken (String user_token) throws com.foxit.sdk.PDFException
 Set the user token to switch it.
More...
 

Static Public Member Functions

static String getClientIDFromServer (String endpoint, ConnectedPDF.ClientInfo client_info) throws com.foxit.sdk.PDFException
 Apply for a client id from ConnectedPDF server using the input client info.
More...
 
static String getDocURI (String file_path) throws com.foxit.sdk.PDFException
 Get the ConnectedPDF document URI from the PDF path.
More...
 
static String getUserTokenFromServer (String endpoint, String user_email, byte[] password) throws com.foxit.sdk.PDFException
 Get the user token from ConnectedPDF server.
More...
 

Detailed Description

Class ConnectedPDF offers following functions,


Convert a normal PDF document to a ConnectedPDF document.
Convert a normal PDF document or a ConnectedPDF document to a ConnectedPDF DRM document.
Decrypt and configure the ACL of ConnectedPDF DRM.

Constructor & Destructor Documentation

◆ ConnectedPDF() [1/4]

com.foxit.sdk.addon.ConnectedPDF.ConnectedPDF ( String  clientid,
String  user_token,
String  content_key,
String  file_path 
) throws com.foxit.sdk.PDFException

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.

Parameters
clientidA client ID whcih is created by function ConnectedPDF::getClientIDFromServer.
user_tokenA user token is created by function ConnectedPDF::getUserTokenFromServer.
content_keyIf 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.
file_pathA path of an existing PDF file.
Note
If module "ConnectedPDF" is not defined in the license information which is used in function common::Library::initialize, that means user has no right in using ConnectedPDF related functions and this constructor will throw exception e_ErrInvalidLicense.

◆ ConnectedPDF() [2/4]

com.foxit.sdk.addon.ConnectedPDF.ConnectedPDF ( String  clientid,
String  user_token,
String  content_key,
FileReaderCallback  file_read 
) throws com.foxit.sdk.PDFException

Constructor, with parameters and a 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.

Parameters
clientidA client ID whcih is created by function ConnectedPDF::getClientIDFromServer.
user_tokenA user token is created by function ConnectedPDF::getUserTokenFromServer.
content_keyIf 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.
file_readA ReaderCallback object which is implemented by user to load a PDF document. It should not be null.
Note
If module "ConnectedPDF" is not defined in the license information which is used in function common::Library::initialize, that means user has no right in using ConnectedPDF related functions and this constructor will throw exception e_ErrInvalidLicense.

◆ ConnectedPDF() [3/4]

com.foxit.sdk.addon.ConnectedPDF.ConnectedPDF ( String  clientid,
String  user_token,
String  content_key,
PDFDoc  document 
) throws com.foxit.sdk.PDFException

Constructor, with parameters and a PDF document object.

The constructed ConnectedPDF object can be converted to a ConnectedPDF document or a ConnectedPDF DRM document.

Parameters
clientidA client ID whcih is created by function ConnectedPDF::getClientIDFromServer.
user_tokenA user token is created by function ConnectedPDF::getUserTokenFromServer.
content_keyIf 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.
documentA valid PDF document object which represents a normal PDF document.
Note
If module "ConnectedPDF" is not defined in the license information which is used in function common::Library::initialize, that means user has no right in using ConnectedPDF related functions and this constructor will throw exception e_ErrInvalidLicense.

◆ ConnectedPDF() [4/4]

com.foxit.sdk.addon.ConnectedPDF.ConnectedPDF ( ConnectedPDF  connected_pdf)

Constructor, with another ConnectedPDF object.

Parameters
connected_pdfAnother ConnectedPDF object

Member Function Documentation

◆ convertToCDRM() [1/2]

int com.foxit.sdk.addon.ConnectedPDF.convertToCDRM ( String  endpoint,
String  wrapper_path,
String  file_name 
) throws com.foxit.sdk.PDFException

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.

Parameters
endpointThe input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com.
wrapper_pathA path of an existing PDF file.
file_nameThe file name used by ConnectedPDF server. If this is an empty string, "Unknown.pdf" will be used as the file name by default
Returns
e_ErrSuccess means success. e_ErrIsAlreadyCDRM means the loaded document has been a ConnectedPDF DRM document.
For other error code value, please refer to values starting from e_ErrSuccess for more details.

◆ convertToCDRM() [2/2]

int com.foxit.sdk.addon.ConnectedPDF.convertToCDRM ( String  endpoint,
FileReaderCallback  wrapper_file_read,
String  file_name 
) throws com.foxit.sdk.PDFException

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.

Parameters
endpointThe input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com.
wrapper_file_readA ReaderCallback object which is implemented by user to save a PDF document.
file_nameThe file name used by ConnectedPDF server. If this is an empty string, "Unknown.pdf" will be used as the file name by default
Returns
e_ErrSuccess means success. e_ErrIsAlreadyCDRM means the loaded document has been a ConnectedPDF DRM document.
For other error code value, please refer to values starting from e_ErrSuccess for more details.

◆ convertToCPDF()

int com.foxit.sdk.addon.ConnectedPDF.convertToCPDF ( String  endpoint,
String  file_name 
) throws com.foxit.sdk.PDFException

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.

Parameters
endpointThe input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com.
file_nameThe file name used by ConnectedPDF server. If this is an empty string, "Unknown.pdf" will be used as the file name by default
Returns
e_ErrSuccess means success. e_ErrIsAlreadyCPDF means the loaded document has been a ConnectedPDF document.
For other error code value, please refer to values starting from e_ErrSuccess for more details.

◆ getACL()

String com.foxit.sdk.addon.ConnectedPDF.getACL ( ) throws com.foxit.sdk.PDFException

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 e_ErrNotCDRM.

Returns
The ACL data string. The data is a JSON string. The JSON string is an array of all the user's ACL. Every element of the array is one user's ACL. The format is described as follows,
    [
      {
        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 pdf::e_PermPrint 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 pdf::e_PermPrint 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"
        }
      }
    ]
    


◆ getClientIDFromServer()

static String com.foxit.sdk.addon.ConnectedPDF.getClientIDFromServer ( String  endpoint,
ConnectedPDF.ClientInfo  client_info 
) throws com.foxit.sdk.PDFException
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 e_ErrCanNotConnectToServer.

Parameters
endpointThe input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com.
client_infoThe input client information used to apply for a client id from ConnectedPDF server.
Returns
The client ID string. If the returned string is not an empty string, that means success.
Note
If module "ConnectedPDF" is not defined in the license information which is used in function common::Library::initialize, that means user has no right in using ConnectedPDF related functions and this function will throw exception e_ErrInvalidLicense.

◆ getContentKey()

String com.foxit.sdk.addon.ConnectedPDF.getContentKey ( ) throws com.foxit.sdk.PDFException

Get the content key if the loaded document is a ConnectedPDF DRM document.

Returns
The content key of ConnectedPDF DRM document.

◆ getDocument()

PDFDoc com.foxit.sdk.addon.ConnectedPDF.getDocument ( ) throws com.foxit.sdk.PDFException

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.

Returns
The associated PDF document object.

◆ getDocURI() [1/2]

static String com.foxit.sdk.addon.ConnectedPDF.getDocURI ( String  file_path) throws com.foxit.sdk.PDFException
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.

Parameters
file_pathA path of an existing PDF file.
Returns
The ConnectedPDF document URI. If the returned string is an empty string, that means the input document is not a valid ConnectedPDF document.
Note
If module "ConnectedPDF" is not defined in the license information which is used in function common::Library::initialize, that means user has no right in using ConnectedPDF related functions and this function will throw exception e_ErrInvalidLicense.

◆ getDocURI() [2/2]

String com.foxit.sdk.addon.ConnectedPDF.getDocURI ( ) throws com.foxit.sdk.PDFException

Get the ConnectedPDF document URI from the loaded document.

Returns
The ConnectedPDF document URI. If the returned string is an empty string, that means the loaded document is not a valid ConnectedPDF document.

◆ getEndpoint()

String com.foxit.sdk.addon.ConnectedPDF.getEndpoint ( ) throws com.foxit.sdk.PDFException

Get the ConnectedPDF document endpoint from the loaded document.

Returns
The ConnectedPDF document endpoint. If the returned string is an empty string, that means the loaded document is not a valid ConnectedPDF document.

◆ getOwnerEmail()

String com.foxit.sdk.addon.ConnectedPDF.getOwnerEmail ( ) throws com.foxit.sdk.PDFException

Get the ConnectedPDF document owner email.

Returns
The ConnectedPDF document owner email.

◆ getOwnerName()

String com.foxit.sdk.addon.ConnectedPDF.getOwnerName ( ) throws com.foxit.sdk.PDFException

Get the ConnectedPDF document owner name.

Returns
The ConnectedPDF document owner name.

◆ getUserToken()

String com.foxit.sdk.addon.ConnectedPDF.getUserToken ( ) throws com.foxit.sdk.PDFException

Get the user token.

Returns
The user token.

◆ getUserTokenFromServer()

static String com.foxit.sdk.addon.ConnectedPDF.getUserTokenFromServer ( String  endpoint,
String  user_email,
byte []  password 
) throws com.foxit.sdk.PDFException
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 e_ErrCanNotConnectToServer.

Parameters
endpointThe input ConnectedPDF server host address. For example, https://www-fz02.connectedpdf.com.
user_emailThe input user email.
passwordThe input user password.
Returns
The user token string. If the returned string is not an empty string, that means success.
Note
If module "ConnectedPDF" is not defined in the license information which is used in function common::Library::initialize, that means user has no right in using ConnectedPDF related functions and this function will throw exception e_ErrInvalidLicense.

◆ getVersionID()

String com.foxit.sdk.addon.ConnectedPDF.getVersionID ( ) throws com.foxit.sdk.PDFException

Get the ConnectedPDF document version ID from the loaded document.

Returns
The ConnectedPDF document version ID. If the returned string is an empty string, that means the loaded document is not a valid ConnectedPDF document.

◆ isCDRM()

boolean com.foxit.sdk.addon.ConnectedPDF.isCDRM ( ) throws com.foxit.sdk.PDFException

Check whether the loaded document is a ConnectedPDF DRM document or not.

Returns
true means the loaded document is a ConnectedPDF DRM document, while false means the loaded document is not a ConnectedPDF DRM document.

◆ isCPDF()

boolean com.foxit.sdk.addon.ConnectedPDF.isCPDF ( ) throws com.foxit.sdk.PDFException

Check whether the loaded document is a ConnectedPDF document or not.

Returns
true means the loaded document is a ConnectedPDF document, while false means the loaded document is not a ConnectedPDF document.

◆ isEmpty()

boolean com.foxit.sdk.addon.ConnectedPDF.isEmpty ( )

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
true means current object is empty, while false means not.

◆ isOwner()

boolean com.foxit.sdk.addon.ConnectedPDF.isOwner ( ) throws com.foxit.sdk.PDFException

Check whether current user is the owner.

Returns
true means current user is the owner, while false means current user is not the owner.

◆ refreshVersionID()

String com.foxit.sdk.addon.ConnectedPDF.refreshVersionID ( ) throws com.foxit.sdk.PDFException

Refresh the ConnectedPDF document version ID from the loaded document.

Returns
The ConnectedPDF document new version ID. If the returned string is an empty string, that means the loaded document is not a valid ConnectedPDF document.

◆ removeCDRM()

int com.foxit.sdk.addon.ConnectedPDF.removeCDRM ( ) throws com.foxit.sdk.PDFException

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.

Returns
e_ErrSuccess means success. e_ErrNotCDRM means the loaded document is not a ConnectedPDF DRM document.
For other error code value, please refer to values starting from e_ErrSuccess for more details.

◆ saveAs() [1/2]

boolean com.foxit.sdk.addon.ConnectedPDF.saveAs ( String  file_path) throws com.foxit.sdk.PDFException

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.

Parameters
file_pathA path for the new saved PDF file. It should not be an empty string.
Returns
true means the saving is successfully finished, while false means failure.

◆ saveAs() [2/2]

boolean com.foxit.sdk.addon.ConnectedPDF.saveAs ( FileWriterCallback  file_write) throws com.foxit.sdk.PDFException

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.

Parameters
file_writeA WriterCallback object which is implemented by user to do the saving.
Returns
true means the saving is successfully finished, while false means failure.

◆ setACL()

int com.foxit.sdk.addon.ConnectedPDF.setACL ( String  acl) throws com.foxit.sdk.PDFException

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.

Parameters
aclThe input ACL data. The data is a JSON string. "userList" is an array of all the user's ACL. Every element of "userList" is one user's ACL. The format is described as follows,
    {
      "userList":
      [
        {
          The user email.
          "userEmail": "fz02_50@qq.com",

The grout ID. Cannot support now. Just leave it empty. "groupId": "",

          Whether the ACL is for a group or not. Cannot support now. Just leave it 0.
          "isGroup": "0",
          Whether the ACL is for everyone or not.
          "everyone": "0",
          Whether the user has full control permission.
          "fullControl": "0",
          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 pdf::e_PermPrint for more information.
          "permission": [4],
          Whether the user can open the document offline. 0=Never 1=By Days 2=Always.
          "offline": "0",
          The permitted offline days.
          "offlineDays": 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".
          "onlineDate": "",
          Expiration days.
          "onlineDays": "0",
          The permitted device count to open the document.
          "deviceLimit": "0",
          Control the specified pages to be hidden.
          "accessPages":
          {
            The content cover over the hidden pages.
            "wrapperContent": "",
            The picture cover over the hidden pages. Cannot support now. Just leave it empty.
            "wrapperPic": "",
            The page indexes to be hidden. For example, [ 1, [2,10],12 ].
            "Pages": [0]
          }
        }
      ]
    }
    
Returns
e_ErrSuccess means success. e_ErrInvalidACL means the input ACL data is invalid. e_ErrNotCDRM means the loaded document is not a ConnectedPDF DRM document.
For other error code value, please refer to values starting from e_ErrSuccess for more details.

◆ setUserToken()

void com.foxit.sdk.addon.ConnectedPDF.setUserToken ( String  user_token) throws com.foxit.sdk.PDFException

Set the user token to switch it.

Parameters
user_tokenThe input user token.
Returns
None.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.