public class PDFLibrary
extends java.lang.Object
PDFLibrary
class offers methods to initialize and unlock the
SDK.
Foxit PDF SDK manages a license control mechanism to determine how to run for
the application purpose.
Foxit PDF SDK license should be purchased for the application and pass unlock
key & code to get proper supports.
It can be constructed by the following way.
Example:
PDFLibrary pdfLibrary = PDFLibrary.getInstance();
Modifier and Type | Field and Description |
---|---|
static int |
LICENSETYPE_AUTHORIZED
Authorized license.
|
static int |
LICENSETYPE_EVALUATION
Evaluation license.
|
static int |
LICENSETYPE_EXPIRED
Expired license.
|
static int |
LICENSETYPE_INVALID
Invalid license.
|
static int |
OBJECTTYPE_DOCUMENT
Document type.
|
static int |
OBJECTTYPE_PAGE
Page type.
|
static int |
OBJECTTYPE_PSI
Pressure sensitive ink type.
|
Modifier and Type | Method and Description |
---|---|
void |
addFontFile(FileHandler fontFile)
Add an additional font (typically a TrueType, Type1 or CFF font) to Foxit
PDF SDK library.
|
void |
destroy()
Finalize PDF module.
|
static PDFLibrary |
getInstance()
Get the
PDFLibrary object. |
int |
getLicenseType()
Get the current license type.
|
void |
initialize(int memorySize,
boolean scaleable)
Initialize the Foxit PDF SDK library.
|
void |
unlock(java.lang.String licenseKey,
java.lang.String unlockCode)
Unlock Foxit PDF SDK library with license key and code.
|
public static final int LICENSETYPE_INVALID
unlock(String, String)
or license
key/code is wrong.public static final int LICENSETYPE_AUTHORIZED
public static final int LICENSETYPE_EVALUATION
public static final int LICENSETYPE_EXPIRED
public static final int OBJECTTYPE_DOCUMENT
public static final int OBJECTTYPE_PAGE
public static final int OBJECTTYPE_PSI
public static PDFLibrary getInstance()
PDFLibrary
object.PDFLibrary
object.public void initialize(int memorySize, boolean scaleable) throws PDFException
Applications should call this function to initialize Foxit PDF SDK library at first.It will cause unexpected errors to call other functions before this one.
memorySize
- A pre-allocated memory buffer to initialize Foxit PDF SDK. In
bytes, it should be 8MB at least.scaleable
- A boolean value specifies whether the memory size is scaled or
not. It means when SDK ran out of the pre-allocated memory,
whether the SDK can be realloc the needed size of memory or
not.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void unlock(java.lang.String licenseKey, java.lang.String unlockCode) throws PDFException
Applications should call this function to unlock library. This function should be called after Foxit PDF SDK library is initialized successfully.
licenseKey
- A String
object that specifies license key value.unlockCode
- A String
object that specifies license code value.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void destroy()
This function releases all internal resources and frees the current Foxit
PDF SDK Library.
This function should be called after Foxit PDF SDK library is unlocked
successfully.
public void addFontFile(FileHandler fontFile) throws PDFException
This function can be called multiple times, each time to add a font to
Foxit PDF SDK Library. When calling the function
to create
a font or display a document which has non-embedded fonts, Foxit PDF SDK
Library will search a font from system fonts and also search all fonts
added by this function.Font.create(String, int, int, int)
fontFile
- A FileHandler
object that is the font file to be added.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
FileHandler
public int getLicenseType() throws PDFException
Applications should call the function
to unlock a library.unlock(String, String)
Using this function to determine which type of license can be accepted.
Please purchase authorized Foxit PDF SDK licenses.
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException