public class PDFNet
extends java.lang.Object
Note: there is only a single, static instance of PDFNet class. Initialization and termination methods need to be called only once per application session.
Modifier and Type | Field and Description |
---|---|
static int |
e_CNS1
The Constant e_CNS1.
|
static int |
e_GB1
The Constant e_GB1.
|
static int |
e_icm
The Constant e_icm.
|
static int |
e_Identity
Standard character orderings.
|
static int |
e_Japan1
The Constant e_Japan1.
|
static int |
e_Japan2
The Constant e_Japan2.
|
static int |
e_Korea1
The Constant e_Korea1.
|
static int |
e_lcms
The Constant e_lcms.
|
static int |
e_LogLevel_Debug |
static int |
e_LogLevel_Error |
static int |
e_LogLevel_Fatal |
static int |
e_LogLevel_Info |
static int |
e_LogLevel_Off |
static int |
e_LogLevel_Trace |
static int |
e_LogLevel_Warning |
static int |
e_no_cms
The Constant e_no_cms.
|
static int |
e_status_bad_Credentials |
static int |
e_status_err |
static int |
e_status_invalid_operation |
static int |
e_status_network_err |
static int |
e_status_ok |
static int |
e_status_service_down |
static int |
e_z_best_compression |
static int |
e_z_best_speed |
static int |
e_z_default_compression |
static int |
e_z_no_compression |
Constructor and Description |
---|
PDFNet() |
Modifier and Type | Method and Description |
---|---|
static boolean |
addFontSubst(int ordering,
java.lang.String fontpath)
Adds the font substitute
|
static boolean |
addFontSubst(java.lang.String fontname,
java.lang.String fontpath)
AddFontSubst functions can be used to create font substitutes that can
override default PDFNet font selection algorithm.
|
static int |
connectToCloud(java.lang.String username,
java.lang.String password)
ConnectToCloud() is used to connect PDFNet with your 'pay-as-you-go' account
(http://www.pdftron.com/pws/onpremise.html).
|
static int |
connectToCloud(java.lang.String username,
java.lang.String password,
boolean demo_mode)
ConnectToCloud() is used to connect PDFNet with your 'pay-as-you-go' account
(http://www.pdftron.com/pws/onpremise.html).
|
static void |
enableJavaScript(boolean enable)
A switch that can be used to turn on/off JavaScript engine
|
static java.lang.String |
getResourcesPath()
Get the resources path.
|
static java.lang.String |
getSystemFontList()
Get available fonts on the system.
|
static double |
getVersion()
Get the version.
|
static void |
initialize()
Initializes PDFNet library.
|
static void |
initialize(java.lang.String license_key)
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 |
setDefaultDeviceCMYKProfile(java.lang.String icc_filename)
Set the default ICC color profile for DeviceCMYK color space.
|
static void |
setDefaultDeviceRGBProfile(java.lang.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(java.lang.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(java.lang.String path)
Set the location of PDFNet resource file.
|
static void |
setTempPath(java.lang.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 |
terminate()
Terminates PDFNet library.
|
public static final int e_status_err
public static final int e_status_ok
public static final int e_status_network_err
public static final int e_status_bad_Credentials
public static final int e_status_service_down
public static final int e_status_invalid_operation
public static final int e_lcms
public static final int e_icm
public static final int e_no_cms
public static final int e_z_default_compression
public static final int e_z_no_compression
public static final int e_z_best_speed
public static final int e_z_best_compression
public static final int e_Identity
public static final int e_Japan1
public static final int e_Japan2
public static final int e_GB1
public static final int e_CNS1
public static final int e_Korea1
public static final int e_LogLevel_Off
public static final int e_LogLevel_Fatal
public static final int e_LogLevel_Error
public static final int e_LogLevel_Warning
public static final int e_LogLevel_Info
public static final int e_LogLevel_Trace
public static final int e_LogLevel_Debug
public static void initialize()
Note: it is unsafe to call any other PDFNet API without first initializing the library
public static void initialize(java.lang.String license_key)
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.public static void enableJavaScript(boolean enable)
enable
- true to enable JavaScript engine, false to disable.public static boolean isJavaScriptEnabled()
public static int connectToCloud(java.lang.String username, java.lang.String password)
Note: Please note that in order to use ConnectToCloud() you need to have a valid Enterprise or Web CPU license for PDFNet. If you do not need additional functionality provided by PDFNet (e.g. you simply need to convert), please use DocPub CLI instead of PDFNet SDK.
Note: ConnectToCloud() should be called once, immediately after PDFNet.Initialize("...license key...").
Note: List of functions supported by pay-as-you-go: - FromEmf (free) - ToEmf (free) - ToSvg (chargeable) - ToPDF (chargeable, except image to PDF) - FromXps (chargeable) - ToXps (chargeable) - ToXod (chargeable) - Flattener (chargeable) - PDFACompliance (chargeable) - ToHtml (chargeable) - ToEpub (chargeable)
username
- Your API ID (i.e. api_id). You should receive this information
via email after Cloud API service (https://api.pdftron.com) sign-up. You can also
find your 'API ID' in the 'Account' section in your PDFTron Cloud account.password
- (i.e. api_secret). This information is provided together with
'api_id' and can also be retrieved from https://api.pdftron.com.public static int connectToCloud(java.lang.String username, java.lang.String password, boolean demo_mode)
Note: Please note that in order to use ConnectToCloud() you need to have a valid Enterprise or Web CPU license for PDFNet. If you do not need additional functionality provided by PDFNet (e.g. you simply need to convert), please use DocPub CLI instead of PDFNet SDK.
Note: ConnectToCloud() should be called once, immediately after PDFNet.Initialize("...license key...").
Note: List of functions supported by pay-as-you-go: - FromEmf (free) - ToEmf (free) - ToSvg (chargeable) - ToPDF (chargeable, except image to PDF) - FromXps (chargeable) - ToXps (chargeable) - ToXod (chargeable) - Flattener (chargeable) - PDFACompliance (chargeable) - ToHtml (chargeable) - ToEpub (chargeable)
username
- Your API ID (i.e. api_id). You should receive this information
via email after Cloud API service (https://api.pdftron.com) sign-up. You can also
find your 'API ID' in the 'Account' section in your PDFTron Cloud account.password
- (i.e. api_secret). This information is provided together with
'api_id' and can also be retrieved from https://api.pdftron.com.demo_mode
- Indicate whether to use dmeo mode.public static void terminate()
Note: it is unsafe to call any other PDFNet API after you terminate the library.
public static boolean setResourcesPath(java.lang.String path)
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.public static java.lang.String getResourcesPath() throws PDFNetException
PDFNetException
public static void setColorManagement(int t) throws PDFNetException
t
- identifies the type of color management to use.PDFNetException
public static void setDefaultDeviceCMYKProfile(java.lang.String icc_filename) throws PDFNetException
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 profilePDFNetException
public static void setDefaultDeviceRGBProfile(java.lang.String icc_filename) throws PDFNetException
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 profilePDFNetException
public static void setDefaultDiskCachingEnabled(boolean use_disk) throws PDFNetException
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
public static void setDefaultFlateCompressionLevel(int level) throws PDFNetException
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
public static void setViewerCache(int max_cache_size, boolean on_disk)
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.public static boolean addFontSubst(java.lang.String fontname, java.lang.String fontpath) throws PDFNetException
fontname
- the fontnamefontpath
- path to fontPDFNetException
- 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");
//...
public static boolean addFontSubst(int ordering, java.lang.String fontpath) throws PDFNetException
ordering
- the orderingfontpath
- path to fontPDFNetException
public static void setTempPath(java.lang.String temp_path) throws PDFNetException
temp_path
- path to temporary folderPDFNetException
public static void setPersistentCachePath(java.lang.String persistent_path) throws PDFNetException
persistent_path
- path to persistent cache folderPDFNetException
public static double getVersion() throws PDFNetException
PDFNetException
public static void setLogLevel(int level) throws PDFNetException
PDFNetException
public static java.lang.String getSystemFontList() throws PDFNetException
PDFNetException