java.lang.Object | |
↳ | com.pdftron.pdf.PDFNet |
PDFNet contains global library initialization, registration, configuration, and termination methods.
Note: there is only a single, static instance of PDFNet class. Initialization and termination methods need to be called only once per application session.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | e_CNS1 | The Constant e_CNS1. | |||||||||
int | e_ConnectionErrorHandlingMode_continue | ||||||||||
int | e_ConnectionErrorHandlingMode_continue_unless_switching_to_demo | ||||||||||
int | e_ConnectionErrorHandlingMode_stop | ||||||||||
int | e_GB1 | The Constant e_GB1. | |||||||||
int | e_Identity | Standard character orderings. | |||||||||
int | e_Japan1 | The Constant e_Japan1. | |||||||||
int | e_Japan2 | The Constant e_Japan2. | |||||||||
int | e_Korea1 | The Constant e_Korea1. | |||||||||
int | e_LogLevel_Debug | ||||||||||
int | e_LogLevel_Error | ||||||||||
int | e_LogLevel_Fatal | ||||||||||
int | e_LogLevel_Info | ||||||||||
int | e_LogLevel_Off | ||||||||||
int | e_LogLevel_Trace | ||||||||||
int | e_LogLevel_Warning | ||||||||||
int | e_icm | The Constant e_icm. | |||||||||
int | e_lcms | The Constant e_lcms. | |||||||||
int | e_no_cms | The Constant e_no_cms. | |||||||||
int | e_status_bad_Credentials | ||||||||||
int | e_status_err | ||||||||||
int | e_status_invalid_operation | ||||||||||
int | e_status_network_err | ||||||||||
int | e_status_ok | ||||||||||
int | e_status_service_down | ||||||||||
int | e_z_best_compression | ||||||||||
int | e_z_best_speed | ||||||||||
int | e_z_default_compression | ||||||||||
int | e_z_no_compression |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PDFNet() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static boolean |
addFontSubst(int ordering, String fontpath)
Adds the font substitute
| ||||||||||
static boolean |
addFontSubst(String fontname, String fontpath)
AddFontSubst functions can be used to create font substitutes that can
override default PDFNet font selection algorithm.
| ||||||||||
static void |
addPDFTronCustomHandler(int custom_id)
Add PDFTron Custom Security handler
| ||||||||||
static void | addResourceSearchPath(String path) | ||||||||||
static void |
enableJavaScript(boolean enable)
A switch that can be used to turn on/off JavaScript engine
| ||||||||||
static String |
getResourcesPath()
Get the resources path.
| ||||||||||
static String |
getSystemFontList()
Get available fonts on the system.
| ||||||||||
static double |
getVersion()
Get the version.
| ||||||||||
static String | getVersionString() | ||||||||||
static void |
initialize(String license_key)
Initializes PDFNet library.
| ||||||||||
static void |
initialize()
Initializes PDFNet library.
| ||||||||||
static boolean |
isJavaScriptEnabled()
Test whether JavaScript is enabled
| ||||||||||
static void |
setColorManagement(int t)
Used to set a specific Color Management System (CMS) for use during color
conversion operators, image rendering, etc.
| ||||||||||
static void |
setConnectionErrorHandlingMode(int mode)
Sets the connection error handling behaviour for Apryse SDK
The default for this method is e_continue
| ||||||||||
static void | setConnectionErrorProc(ConnectionErrorProc error_proc, Object data) | ||||||||||
static void |
setDefaultDeviceCMYKProfile(String icc_filename)
Set the default ICC color profile for DeviceCMYK color space.
| ||||||||||
static void |
setDefaultDeviceRGBProfile(String icc_filename)
Set the default ICC color profile for DeviceRGB color space.
| ||||||||||
static void |
setDefaultDiskCachingEnabled(boolean use_disk)
Sets the default policy on using temporary files.
| ||||||||||
static void |
setDefaultFlateCompressionLevel(int level)
Sets the default compression level for Flate (ZLib).
| ||||||||||
static void | setLogLevel(int level) | ||||||||||
static void |
setPersistentCachePath(String persistent_path)
Set the location of persistent cache files
This method is provided for applications that require tight control of
the location where temporary files are created.
| ||||||||||
static boolean |
setResourcesPath(String path)
Set the location of PDFNet resource file.
| ||||||||||
static void |
setTempPath(String temp_path)
Set the location of temporary folder.
| ||||||||||
static void |
setViewerCache(int max_cache_size, boolean on_disk)
Sets the default parameters for the viewer cache.
| ||||||||||
static void |
setWriteAPIUsageLocally(boolean write_usage)
Enable writing API usage locally.
| ||||||||||
static void |
terminate()
Terminates PDFNet library.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
The Constant e_CNS1.
The Constant e_GB1.
Standard character orderings. PDFNet.AddFontSubst() can be used to associate a specific font with a given character ordering and to override default font mapping algorithm.
The Constant e_Japan1.
The Constant e_Japan2.
The Constant e_Korea1.
The Constant e_icm.
The Constant e_lcms.
The Constant e_no_cms.
Adds the font substitute
ordering | the ordering |
---|---|
fontpath | path to font |
PDFNetException |
---|
AddFontSubst functions can be used to create font substitutes that can override default PDFNet font selection algorithm. These functions are useful in situations where referenced fonts are not present in the document and PDFNet font substitution algorithm is not producing desired results. AddFontSubst(fontname, fontpath) maps the given font name (i.e. 'BaseFont' entry from the font dictionary) to a font file. AddFontSubst(ordering, fontpath) maps the given character ordering (see Ordering entry in CIDSystemInfo dictionary; Section 5.6.2 in PDF Reference) to a font file. This method is less specific that the former variant of AddFontSubst, and can be used to override a range of missing fonts (or any missing font) with a predefined substitute. The following is an example of using these functions to provide user defined font substitutes:
fontname | the fontname |
---|---|
fontpath | path to font |
PDFNetException | PDFNet.initialize(); PDFNet.setResourcesPath("c:/myapp/resources");
// Specify specific font mappings...
PDFNet.addFontSubst("MinionPro-Regular",
"c:/myfonts/MinionPro-Regular.otf");
PDFNet.addFontSubst("Times-Roman", "c:/windows/fonts/times.ttf");
PDFNet.addFontSubst("Times-Italic", "c:/windows/fonts/timesi.ttf");
// Specify more general font mappings...
PDFNet.addFontSubst(PDFNet.e_Identity, "c:/myfonts/arialuni.ttf");
// Arial Unicode MS PDFNet.addFontSubst(PDFNet.e_Japan1,
"c:/myfonts/KozMinProVI-Regular.otf");
PDFNet.addFontSubst(PDFNet.e_Japan2,
"c:/myfonts/KozMinProVI-Regular.otf");
PDFNet.addFontSubst(PDFNet.e_Korea1,
"c:/myfonts/AdobeSongStd-Light.otf");
PDFNet.addFontSubst(PDFNet.e_CNS1,
"c:/myfonts/AdobeMingStd-Light.otf");
PDFNet.addFontSubst(PDFNet.e_GB1,
"c:/myfonts/AdobeMyungjoStd-Medium.otf");
//...
PDFDoc doc = new PDFDoc("c:/my.pdf");
//...
|
---|
Add PDFTron Custom Security handler
custom_id | The user's custom id. The id should match what was used to create PDFTronCustomSecurityHandler when encrypting the document. Note: calling this function is a requirement to load files encrypted with PDFTronCustomSecurityHandler. |
---|
PDFNetException |
---|
A switch that can be used to turn on/off JavaScript engine
enable | true to enable JavaScript engine, false to disable. |
---|
Get the resources path.
PDFNetException |
---|
Get available fonts on the system.
PDFNetException |
---|
Initializes PDFNet library. Initialize() is usually called once, during process initialization.
Note: it is unsafe to call any other PDFNet API without first initializing the library
license_key | Optional license key used to activate the product. If the license_key is not specified, the product will work in demo mode. If the license_key is invalid, the function will throw an exception. |
---|
Initializes PDFNet library. Initialize() is usually called once, during process initialization.
Note: With the exception of SetPersistentCache and SetTempPath, it is unsafe to call any other PDFNet API without first initializing the library
Test whether JavaScript is enabled
Used to set a specific Color Management System (CMS) for use during color conversion operators, image rendering, etc.
t | identifies the type of color management to use. |
---|
PDFNetException |
---|
Sets the connection error handling behaviour for Apryse SDK The default for this method is e_continue
mode | Rules that Apryse SDK will follow after a connection error. |
---|
PDFNetException |
---|
PDFNetException |
---|
Set the default ICC color profile for DeviceCMYK color space.
Note: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual.
icc_filename | the new default device CMYK profile |
---|
PDFNetException |
---|
Set the default ICC color profile for DeviceRGB color space.
Note: You can use this method to override default PDFNet settings. For more information on default color spaces please refer to section 'Default Color Spaces' in Chapter 4.5.4 of PDF Reference Manual.
icc_filename | the new default device RGB profile |
---|
PDFNetException |
---|
Sets the default policy on using temporary files.
use_disk | if parameter is true then new documents are allowed to create temporary files; otherwise all document contents will be stored in memory. |
---|
PDFNetException |
---|
Sets the default compression level for Flate (ZLib).
level | An integer in range 0-9 representing the compression value to use as a default for any Flate streams (e.g used to compress content streams, PNG images, etc). The library normally uses the default compression level (e_z_default_compression). For most images, compression values in the range 3-6 compress nearly as well as higher levels, and do so much faster. For on-line applications it may be desirable to have maximum speed e_z_best_speed = 1). You can also specify no compression (e_z_no_compression = 0). Default is e_z_default_compression (-1). |
---|
PDFNetException |
---|
Set the location of persistent cache files This method is provided for applications that require tight control of the location where temporary files are created.
persistent_path | path to persistent cache folder |
---|
PDFNetException |
---|
Set the location of PDFNet resource file.
Note: Starting with v.4.5 PDFNet does't require a separate resource file (pdfnet.res) on all desktop/server platfroms. As a result, this function is not longer required for proper PDFNet initialization. The function is still available on embedded systems and for backwards compatibility. The function can be also used to specify a deault search path for ICC profiles, fonts, and other user defined resources.
path | The default resource directory path. |
---|
Set the location of temporary folder. This method is provided for applications that require tight control of the location where temporary files are created.
temp_path | path to temporary folder |
---|
PDFNetException |
---|
Sets the default parameters for the viewer cache. Any subsequently opened documents will use these parameters.
Note: Default Desktop - max_cache_size: 512 MB, on_disk = true. Default Mobile - max_cache_size: 100 MB, on_disk = false
max_cache_size | The maximum size, in bytes, of the entire document's page cache. Set to zero to disable the viewer cache. |
---|---|
on_disk | If set to 'true', cache will be stored on the local filesystem. If set to 'false', cache will be stored in heap memory. |
Enable writing API usage locally.
write_usage | if parameter is true API usage will be written to local JSON files in the persistent cache path otherwise no API usage is saved. |
---|
PDFNetException |
---|
Terminates PDFNet library. Terminate() is usually called once, when the process is terminated.
Note: it is unsafe to call any other PDFNet API after you terminate the library.