Foxit PDF Conversion SDK
com.foxit.sdk.common.Library类 参考

Public 成员函数

synchronized void delete ()
 直接清除C++相关资源。 更多...
 

静态 Public 成员函数

static void enableThreadSafety (boolean is_enable_thread_safety)
 启用线程安全。 更多...
 
static String getVersion () throws com.foxit.sdk.PDFException
 获取当前Foxit PDF Conversion SDK库的版本。 更多...
 
static int initialize (String sn, String key) throws com.foxit.sdk.PDFException
 使用有效的许可证信息初始化Foxit PDF Conversion SDK库。 更多...
 
static int reinitialize () throws com.foxit.sdk.PDFException
 重新初始化Foxit PDF Conversion SDK库。 更多...
 
static void release () throws com.foxit.sdk.PDFException
 释放Foxit PDF Conversion SDK库分配的所有资源。 更多...
 
static boolean setConvertCheckCallback (ConvertCheckCallback convert_check_callback)
 设置回调对象以检查PDF到Office转换的条件。 更多...
 

详细描述

此类表示库管理。 它包含初始化/重新初始化/释放Foxit PDF Conversion SDK库的函数,也包含 全局使用的函数。
任何应用程序在调用任何其他Foxit PDF Conversion SDK函数之前,都应通过函数 Library.initialize 加载Foxit PDF Conversion SDK。 当不再需要使用Foxit PDF Conversion SDK时,请调用函数 Library.release
Foxit PDF Conversion SDK中的函数在发生某些错误时可能会抛出异常。用户可以捕获这些异常, 并通过从 com.foxit.sdk.common.Constants.e_ErrFile 开始的值检查错误代码,以了解发生了什么错误。

注解
在应用程序的生命周期中,Library.initialize Library.release 应该 成对调用,并且只能调用一次。一旦在应用程序的生命周期中调用了 Library.release , 在应用程序的生命周期中就不能再初始化Foxit PDF Conversion SDK了。 在调用 Library.release 之前,如果用户想要重新初始化Foxit PDF Conversion SDK,请参考 函数 Library.reinitialize

成员函数说明

◆ delete()

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

直接清除C++相关资源。

返回
无。
注解
一旦这个接口被调用,这个对象将不能再被使用。

◆ enableThreadSafety()

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

启用线程安全。

参数
[in]is_enable_thread_safety启用线程安全。true 表示启用线程安全, 而 false 表示禁用线程安全。
返回
无。

◆ getVersion()

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

获取当前Foxit PDF Conversion SDK库的版本。

返回
版本字符串。

◆ initialize()

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

使用有效的许可证信息初始化Foxit PDF Conversion SDK库。

在应用程序的生命周期中,此函数只能调用一次, 并且应在调用Foxit PDF Conversion SDK中的任何其他函数之前首先调用。
一旦调用了函数 Library.release ,在应用程序的生命周期中 就不能再初始化Foxit PDF Conversion SDK库了。

参数
[in]snsn信息字符串,可以从密钥文件"gsdk_sn.txt"或"rdk_sn.txt"中的"SN="部分检索。
[in]key密钥信息字符串,可以从密钥文件"gsdk_key.txt"或"rdk_key.txt"中的"Sign="部分检索。
返回
com.foxit.sdk.common.Constants.e_ErrSuccess 表示成功。
com.foxit.sdk.common.Constants.e_ErrInvalidLicense 表示输入的许可证信息无效。
com.foxit.sdk.common.Constants.e_ErrParam 表示参数 snkey 是空字符串。
有关错误代码值的更多信息,请参考从 com.foxit.sdk.common.Constants.e_ErrSuccess 开始的值。

◆ reinitialize()

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

重新初始化Foxit PDF Conversion SDK库。

当用户遇到内存不足错误或用户想要在调用函数 Library.release 之前 重新初始化Foxit PDF Conversion SDK库时,用户可以调用此函数来重新初始化Foxit PDF Conversion SDK库。
一旦调用了函数 Library.release ,在应用程序的生命周期中 就不能再初始化Foxit PDF Conversion SDK库了。

返回
com.foxit.sdk.common.Constants.e_ErrSuccess 表示成功。 有关错误代码值的更多信息,请参考从 com.foxit.sdk.common.Constants.e_ErrSuccess 开始的值。

◆ release()

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

释放Foxit PDF Conversion SDK库分配的所有资源。

用户应调用此函数来释放库分配的所有内存块。
一旦调用了此函数,在应用程序的生命周期中 就不能再初始化Foxit PDF Conversion SDK库了。

返回
无。

◆ setConvertCheckCallback()

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

设置回调对象以检查PDF到Office转换的条件。

此方法允许您指定一个自定义的转换检查回调,当转换PDF文档所需的权限不满足时, 将调用该回调来评估是否应继续从PDF到Office的转换,基于用户自定义的逻辑。

参数
[in]convert_check_callback基于回调类 com.foxit.sdk.common.ConvertCheckCallback 实现的自定义转换检查回调。 如果为 null,将移除自定义转换检查回调,并使用默认的转换检查。
返回
true 表示成功,而 false 表示失败。