Foxit PDF Conversion SDK

Public Member Functions | Static Public Member Functions | List of all members
com.foxit.sdk.common.Library Class Reference

## Public Member Functions
synchronized void | delete ()
| Clean up related C++ resources immediately. More...

## Static Public Member Functions
static void | enableThreadSafety (boolean is_enable_thread_safety)
| Enable thread safety. More...
static String | getVersion () throws com.foxit.sdk.PDFException
| Get the version of current Foxit PDF Conversion SDK library. More...
static int | initialize (String sn, String key) throws com.foxit.sdk.PDFException
| Initialize Foxit PDF Conversion SDK Library, with valid license information. More...
static int | reinitialize () throws com.foxit.sdk.PDFException
| Re-initialize Foxit PDF Conversion SDK Library. More...
static void | release () throws com.foxit.sdk.PDFException
| Release all resource allocated by Foxit PDF Conversion SDK Library. More...
static boolean | setConvertCheckCallback (ConvertCheckCallback convert_check_callback)
| Set the callback object to check the PDF to Office conversion conditions. More...

## Detailed Description

This class represents the library management. It contains functions to initialize/re-initialize/release Foxit PDF Conversion SDK library, and also contains functions for global use.
Any application should load Foxit PDF Conversion SDK by function Library.initialize before calling any other Foxit PDF Conversion SDK functions. When there is no need to use Foxit PDF Conversion SDK any more, please call function Library.release .
Functions in Foxit PDF Conversion SDK may throw exception when some error occurs. User can catch these exceptions and check the error code with values starting from com.foxit.sdk.common.Constants.e_ErrFile to know more about what error occurs.

Note
  During the life-cycle of an application, Library.initialize and Library.release should be called in pair and can only be called once. Once Library.release is called during the life-cycle of an application, Foxit PDF Conversion SDK cannot be initialized any more in the life-cycle of the application. Before Library.release is called, if user wants to re-initialize Foxit PDF Conversion SDK, please refer to function Library.reinitialize .

## Member Function Documentation

## ◆ delete()

synchronized void com.foxit.sdk.common.Library.delete | ( |  | ) |

Clean up related C++ resources immediately.

Returns
  None.

Note
  Once this function is called, current object cannot be used anymore.

## ◆ enableThreadSafety()

static void com.foxit.sdk.common.Library.enableThreadSafety | ( | boolean | is_enable_thread_safety | ) |
| static

Enable thread safety.

Parameters

  [in] | is_enable_thread_safety | Enable thread safety.true means to enable thread safety, while false means to disable thread safety.

Returns
  None.

## ◆ getVersion()

static String com.foxit.sdk.common.Library.getVersion | ( |  | ) | throws com.foxit.sdk.PDFException
| static

Get the version of current Foxit PDF Conversion SDK library.

Returns
  Version string.

## ◆ initialize()

static int com.foxit.sdk.common.Library.initialize | ( | String | sn,
|  | String | key
| ) |  | throws com.foxit.sdk.PDFException
| static

Initialize Foxit PDF Conversion SDK Library, with valid license information.

During the life-cycle of an application, this function can only be called once and should be called first before any other functions in Foxit PDF Conversion SDK can be called.
Once function Library.release is called, Foxit PDF Conversion SDK library cannot be initialized any more in the life- cycle of the application.

Parameters

  [in] | sn | String of sn information, which can be retrieved from "SN=" part in key file "gsdk_sn.txt" or "rdk_sn.txt".
  [in] | key | String of key information, which can be retrieved from "Sign=" part in key file "gsdk_key.txt" or "rdk_key.txt".

Returns
  com.foxit.sdk.common.Constants.e_ErrSuccess means success.
  com.foxit.sdk.common.Constants.e_ErrInvalidLicense means input license information is invalid.
  com.foxit.sdk.common.Constants.e_ErrParam means parameter sn or key is an empty string.
  For more information about error code values, please refer to values starting from com.foxit.sdk.common.Constants.e_ErrSuccess .

## ◆ reinitialize()

static int com.foxit.sdk.common.Library.reinitialize | ( |  | ) | throws com.foxit.sdk.PDFException
| static

Re-initialize Foxit PDF Conversion SDK Library.

When user meets out-of-memory error or user wants to re-initialize Foxit PDF Conversion SDK library before function Library.release is called, user can call this function to re-initialize Foxit PDF Conversion SDK Library.
Once function Library.release is called, Foxit PDF Conversion SDK library cannot be initialized any more in the life- cycle of the application.

Returns
  com.foxit.sdk.common.Constants.e_ErrSuccess means success. For more information about error code values, please refer to values starting from com.foxit.sdk.common.Constants.e_ErrSuccess .

## ◆ release()

static void com.foxit.sdk.common.Library.release | ( |  | ) | throws com.foxit.sdk.PDFException
| static

Release all resource allocated by Foxit PDF Conversion SDK Library.

User should call this function to release all memory blocks allocated by the library.
Once this fucntion is called, Foxit PDF Conversion SDK library cannot be initialized any more in the life-cycle of the application.

Returns
  None.

## ◆ setConvertCheckCallback()

static boolean com.foxit.sdk.common.Library.setConvertCheckCallback | ( | ConvertCheckCallback | convert_check_callback | ) |
| static

Set the callback object to check the PDF to Office conversion conditions.

This method allows you to specify a custom convert check callback that will be called to evaluate whether the conversion from PDF to Office should proceed, based on user-defined logic , when the required permissions for converting the PDF documents are not met.

Parameters

  [in] | convert_check_callback | A customized convert check callback which is implemented based on callback class com.foxit.sdk.common.ConvertCheckCallback . If this is null, customized convert check callback will be removed and default convert check will be used instead.

Returns
  true means success, while false means failure.