SignDoc SDK (Java)
5.0.0
|
Create SignDocDocument objects. More...
Public Member Functions | |
SignDocDocumentLoader () throws SignDocException | |
Constructor. More... | |
synchronized void | close () |
Destroy the underlying native object (for java.lang.AutoCloseable). More... | |
synchronized SignDocDocument | loadFromMemory (byte[] aData) throws SignDocException |
Load a document from memory. More... | |
synchronized SignDocDocument | loadFromFile (String aPath, boolean aWritable) throws SignDocException |
Load a document from a file. More... | |
synchronized SignDocDocument | createPDF (int aMajor, int aMinor) throws SignDocException |
Create an empty PDF document. More... | |
synchronized SignDocDocument | createPDFA (int aMajor, int aMinor, String aConformance, byte[] aICC) throws SignDocException |
Create an empty PDF/A document. More... | |
synchronized int | ping (java.io.InputStream aStream) throws SignDocException |
Check if a document is supported by this handler. More... | |
synchronized int | ping (byte[] aBlob) throws SignDocException |
Check if a document is supported by this handler. More... | |
synchronized void | loadFontConfigFile (String aPath) throws SignDocException |
Load font configuration from a file. More... | |
synchronized void | loadFontConfigEnvironment (String aName) throws SignDocException |
Load font configuration from files specified by an environment variable. More... | |
synchronized void | loadFontConfigStream (java.io.InputStream aStream, String aDirectory) throws SignDocException |
Load font configuration from a stream. More... | |
synchronized void | loadFontConfigBlob (byte[] aBlob, String aDirectory) throws SignDocException |
Load font configuration from a blob. More... | |
synchronized void | loadPdfFontConfigFile (String aPath) throws SignDocException |
Load font configuration for rendering PDF documents from a file. More... | |
synchronized void | loadPdfFontConfigEnvironment (String aName) throws SignDocException |
Load font configuration for rendering PDF documents from files specified by an environment variable. More... | |
synchronized void | loadPdfFontConfigStream (java.io.InputStream aStream, String aDirectory) throws SignDocException |
Load font configuration for rendering PDF documents from a stream. More... | |
synchronized void | loadPdfFontConfigBlob (byte[] aBlob, String aDirectory) throws SignDocException |
Load font configuration for rendering PDF documents from a blob. More... | |
synchronized String[] | getFailedFontFiles () throws SignDocException |
Get the pathnames of font files that failed to load for the most recent loadFontConfig*() or loadPdfFontConfig*() call. More... | |
synchronized void | loadTrustedCertificatesFromFile (String aPath) throws SignDocException |
Load trusted root CA certifcates from a file. More... | |
synchronized void | loadTrustedCertificatesFromStream (java.io.InputStream aStream) throws SignDocException |
Load trusted root CA certifcates from a stream. More... | |
synchronized void | loadTrustedCertificatesFromMemory (byte[] aBlob) throws SignDocException |
Load trusted root CA certifcates from a blob. More... | |
synchronized void | setFlags (int aFlags) throws SignDocException |
Set flags modifying the behavior of this SignDocDocumentLoader object and of the SignDocDocument objects created by it. More... | |
Static Public Member Functions | |
static void | setLicenseKey (byte[] aKey, String aProduct, String aVersion, byte[] aToken) throws SignDocException |
Initialize license management with license key. More... | |
static void | setLicenseKey (String aKey, String aProduct, String aVersion, byte[] aToken) throws SignDocException, java.io.UnsupportedEncodingException |
Initialize license management with license key. More... | |
static int | getRemainingDays (int aWhat) throws SignDocException |
Get the number of days until the license will expire. More... | |
static byte[] | generateLicenseToken (String aProduct) throws SignDocException |
Generate a license token for other SDKs also covered by the license key passed to setLicenseKey(). More... | |
static String | getVersionNumber () throws SignDocException |
Get the version number of SignDoc SDK. More... | |
static String | getComponentVersionNumber (String aComponent) throws SignDocException |
Get the version number of a SignDoc SDK component. More... | |
static int | getLicenseTextCount () throws SignDocException |
Get the number of license texts. More... | |
static String | getLicenseText (int aIndex) throws SignDocException |
Get a license text. More... | |
static void | initLogging (String aLevel, String aPathname, boolean aSetEnv) throws SignDocException |
Initialize logging. More... | |
Static Public Attributes | |
static final int | rd_product = 0 |
Specify which expiry date shall be used by getRemainingDays(): Use the expiry date for the product. More... | |
static final int | rd_signing = 1 |
Specify which expiry date shall be used by getRemainingDays(): Use the expiry date for signing documents. More... | |
static final int | f_map_into_memory = 0x01 |
Flag for setFlags(): map input file into memory. More... | |
Protected Member Functions | |
void | finalize () throws Throwable |
Finalize this object. More... | |
Create SignDocDocument objects.
Unless you need differently configured SignDocDocumentLoader objects, you should have only one SignDocDocumentLoader object per process. Loading font configuration files can be expensive, in particular if many fonts have to be scanned.
On Android, this class must be loaded by the UI thread.
SignDocDocumentLoader | ( | ) | throws SignDocException |
Constructor.
synchronized void close | ( | ) |
Destroy the underlying native object (for java.lang.AutoCloseable).
After calling this method, all methods but close() will throw SignDocUnexpectedErrorException.
synchronized SignDocDocument createPDF | ( | int | aMajor, |
int | aMinor | ||
) | throws SignDocException |
Create an empty PDF document.
The PDF document is invalid until you add at least one page. SignDocDocument.addSignature() cannot be used until the document has been saved.
[in] | aMajor | Major PDF version, must be 1 or 2. |
[in] | aMinor | Minor PDF version, must be 0 through 7 (if aMajor is 1) or 0 (if aMajor is 2). |
synchronized SignDocDocument createPDFA | ( | int | aMajor, |
int | aMinor, | ||
String | aConformance, | ||
byte[] | aICC | ||
) | throws SignDocException |
Create an empty PDF/A document.
The PDF document is invalid until you add at least one page. SignDocDocument.addSignature() cannot be used until the document has been saved.
[in] | aMajor | Major PDF version, must be 1. |
[in] | aMinor | Minor PDF version, must be 0 through 7. |
[in] | aConformance | PDF/A conformance. This string must consist of two characters:
|
[in] | aICC | The ICC profile of the PDF/A output intent or null if no output intent shall be added to the document. |
|
protected |
Finalize this object.
Do not call this method unless you know what you are doing.
|
static |
Generate a license token for other SDKs also covered by the license key passed to setLicenseKey().
[in] | aProduct | The name of the product which shall be able to use the license key without providing a product version. |
|
static |
Get the version number of a SignDoc SDK component.
[in] | aComponent | The component. Currently supported are "sppdf", "splm2", and "spooc". |
synchronized String [] getFailedFontFiles | ( | ) | throws SignDocException |
Get the pathnames of font files that failed to load for the most recent loadFontConfig*() or loadPdfFontConfig*() call.
This includes files that could not be found and files that could not be loaded. In the former case, the pathname may contain wildcard characters.
Note that loadFontConfig*() and loadPdfFontConfig() no longer fail if a specified font file cannot be found or loaded.
|
static |
Get a license text.
SignDoc SDK includes several Open Source components. You can retrieve the license texts one by one.
[in] | aIndex | The zero-based index of the license text. |
|
static |
Get the number of license texts.
SignDoc SDK includes several Open Source components. You can retrieve the license texts one by one.
|
static |
Get the number of days until the license will expire.
[in] | aWhat | Select which expiry date shall be used (rd_product or rd_signing). |
|
static |
Get the version number of SignDoc SDK.
|
static |
Initialize logging.
This function throws an exception if the log file cannot be opened. This function initializes logging for all threads of the current process.
[in] | aLevel | The logging level: "0" (log nothing) through "5" (log everything), optionally followed by "T" to log process and thread IDs. |
[in] | aPathname | The pathname of the log file. |
[in] | aSetEnv | true to set the SPDEBUG and SPDEBUGDIR environment variables from aLevel and aPathname, respectively. This will happen only if the log file is opened successfully. |
synchronized void loadFontConfigBlob | ( | byte[] | aBlob, |
String | aDirectory | ||
) | throws SignDocException |
Load font configuration from a blob.
Suitable fonts are required for putting text containing characters that cannot be encoded using WinAnsiEncoding into text fields, FreeText annotations, DigSig appearances, watermarks, and pages of PDF documents. See section Font Configuration.
The font configuration applies to all SignDocDocument objects created by this object.
Use getFailedFontFiles() after calling this function to get the pathnames of any fonts that could not be loaded.
[in] | aBlob | A blob containing the XML document. |
[in] | aDirectory | If non-null, relative font pathnames will be relative to this directory. The directory must exist and must be readable. If null, relative font pathnames will make this function fail. |
synchronized void loadFontConfigEnvironment | ( | String | aName | ) | throws SignDocException |
Load font configuration from files specified by an environment variable.
Suitable fonts are required for putting text containing characters that cannot be encoded using WinAnsiEncoding into text fields, FreeText annotations, DigSig appearances, watermarks, and pages of PDF documents. See section Font Configuration.
Under Windows, directories are separated by semicolons. Under Unix, directories are separated by colons.
The font configuration applies to all SignDocDocument objects created by this object.
Use getFailedFontFiles() after calling this function to get the pathnames of any fonts that could not be loaded.
[in] | aName | The name of the environment variable. |
synchronized void loadFontConfigFile | ( | String | aPath | ) | throws SignDocException |
Load font configuration from a file.
Suitable fonts are required for putting text containing characters that cannot be encoded using WinAnsiEncoding into text fields, FreeText annotations, DigSig appearances, watermarks, and pages of PDF documents. See section Font Configuration.
The font configuration applies to all SignDocDocument objects created by this object.
Use getFailedFontFiles() after calling this function to get the pathnames of any fonts that could not be loaded.
[in] | aPath | The pathname of the file. |
synchronized void loadFontConfigStream | ( | java.io.InputStream | aStream, |
String | aDirectory | ||
) | throws SignDocException |
Load font configuration from a stream.
Suitable fonts are required for putting text containing characters that cannot be encoded using WinAnsiEncoding into text fields, FreeText annotations, DigSig appearances, watermarks, and pages of PDF documents. See section Font Configuration.
The font configuration applies to all SignDocDocument objects created by this object.
Use getFailedFontFiles() after calling this function to get the pathnames of any fonts that could not be loaded.
[in] | aStream | The font configuration will be read from this stream. This function reads the input completely, it doesn't stop at the end tag. |
[in] | aDirectory | If non-null, relative font pathnames will be relative to this directory. The directory must exist and must be readable. If null, relative font pathnames will make this function fail. |
synchronized SignDocDocument loadFromFile | ( | String | aPath, |
boolean | aWritable | ||
) | throws SignDocException |
Load a document from a file.
Signing the document will overwrite the document, but see string parameter "OutputPath" of SignDocSignatureParameters.
You can open FDF files that reference a PDF file; the referenced PDF file will be opened and the FDF file will be applied to the loaded copy (using sff_font_fail). If the pathname of the referenced PDF file is not an absolute pathname, it will be interpreted as being relative to the directory containing the FDF file.
The file will remain open until the document is saved or the SignDocDocument object is closed or destroyed.
[in] | aPath | Pathname of the document file. |
[in] | aWritable | Open for writing (used for signing TIFF documents in place, ignored for PDF documents). |
synchronized SignDocDocument loadFromMemory | ( | byte[] | aData | ) | throws SignDocException |
Load a document from memory.
[in] | aData | Blob representing the document. The data must not be modified. |
synchronized void loadPdfFontConfigBlob | ( | byte[] | aBlob, |
String | aDirectory | ||
) | throws SignDocException |
Load font configuration for rendering PDF documents from a blob.
Additional fonts may be required for rendering PDF documents. The font configuration for rendering PDF documents contains mappings from font names to font files. See section Font Configuration.
The font configuration for rendering PDF documents is global, ie, it affects all PDF documents, no matter by which SignDocDocumentLoader object they have been created.
Use getFailedFontFiles() after calling this function to get the pathnames of any fonts that could not be loaded.
[in] | aBlob | A blob containing the XML document. |
[in] | aDirectory | If non-null, relative font pathnames will be relative to this directory. The directory must exist and must be readable. If null, relative font pathnames will make this function fail. |
synchronized void loadPdfFontConfigEnvironment | ( | String | aName | ) | throws SignDocException |
Load font configuration for rendering PDF documents from files specified by an environment variable.
Additional fonts may be required for rendering PDF documents. The font configuration for rendering PDF documents contains mappings from font names to font files. See section Font Configuration.
The font configuration for rendering PDF documents is global, ie, it affects all PDF documents, no matter by which SignDocDocumentLoader object they have been created.
Under Windows, directories are separated by semicolons. Under Unix, directories are separated by colons.
Use getFailedFontFiles() after calling this function to get the pathnames of any fonts that could not be loaded.
[in] | aName | The name of the environment variable. |
synchronized void loadPdfFontConfigFile | ( | String | aPath | ) | throws SignDocException |
Load font configuration for rendering PDF documents from a file.
Additional fonts may be required for rendering PDF documents. The font configuration for rendering PDF documents contains mappings from font names to font files. See section Font Configuration.
The font configuration for rendering PDF documents is global, ie, it affects all PDF documents, no matter by which SignDocDocumentLoader object they have been created.
Use getFailedFontFiles() after calling this function to get the pathnames of any fonts that could not be loaded.
[in] | aPath | The pathname of the file. |
synchronized void loadPdfFontConfigStream | ( | java.io.InputStream | aStream, |
String | aDirectory | ||
) | throws SignDocException |
Load font configuration for rendering PDF documents from a stream.
Additional fonts may be required for rendering PDF documents. The font configuration for rendering PDF documents contains mappings from font names to font files. See section Font Configuration.
The font configuration for rendering PDF documents is global, ie, it affects all PDF documents, no matter by which SignDocDocumentLoader object they have been created.
Use getFailedFontFiles() after calling this function to get the pathnames of any fonts that could not be loaded.
[in] | aStream | The font configuration will be read from this stream. This function reads the input completely, it doesn't stop at the end tag. |
[in] | aDirectory | If non-null, relative font pathnames will be relative to this directory. The directory must exist and must be readable. If null, relative font pathnames will make this function fail. |
synchronized void loadTrustedCertificatesFromFile | ( | String | aPath | ) | throws SignDocException |
Load trusted root CA certifcates from a file.
The loaded certificates are used for all SignDocDocument objects created by this object. They are used for signature verification and HTTPS connections. For iOS, they replace the system's trusted anchors, for other operating systems, they are used in addition to the operating system's trusted root CA certificates.
The file must contain either a single DER-encoded X.509 certificate or at least one PEM-encoded X.509 certificate.
Calls to loadTrustedCertificatesFromFile(), loadTrustedCertificatesFromMemory() and loadTrustedCertificatesFromStream() are cumulative.
[in] | aPath | The pathname of the file. |
synchronized void loadTrustedCertificatesFromMemory | ( | byte[] | aBlob | ) | throws SignDocException |
Load trusted root CA certifcates from a blob.
The loaded certificates are used for all SignDocDocument objects created by this object. They are used for signature verification and HTTPS connections. For iOS, they replace the system's trusted anchors, for other operating systems, they are used in addition to the operating system's trusted root CA certificates.
The blob must contain either a single DER-encoded X.509 certificate or at least one PEM-encoded X.509 certificate.
[in] | aBlob | The certificates will be read from this blob. |
synchronized void loadTrustedCertificatesFromStream | ( | java.io.InputStream | aStream | ) | throws SignDocException |
Load trusted root CA certifcates from a stream.
The loaded certificates are used for all SignDocDocument objects created by this object. They are used for signature verification and HTTPS connections. For iOS, they replace the system's trusted anchors, for other operating systems, they are used in addition to the operating system's trusted root CA certificates.
The stream must contain either a single DER-encoded X.509 certificate or at least one PEM-encoded X.509 certificate.
[in] | aStream | The certificates will be read from this stream. |
synchronized int ping | ( | java.io.InputStream | aStream | ) | throws SignDocException |
Check if a document is supported by this handler.
[in] | aStream | A seekable stream positioned at the first octet of the document. |
synchronized int ping | ( | byte[] | aBlob | ) | throws SignDocException |
Check if a document is supported by this handler.
[in] | aBlob | A blob containing the document. |
synchronized void setFlags | ( | int | aFlags | ) | throws SignDocException |
Set flags modifying the behavior of this SignDocDocumentLoader object and of the SignDocDocument objects created by it.
[in] | aFlags | The flags: 0 or f_map_into_memory. |
|
static |
Initialize license management with license key.
License management must be initialized before the non-static methods of SignDocDocumentLoader can be used.
[in] | aKey | The license key as array of bytes. |
[in] | aProduct | Should be null. |
[in] | aVersion | Should be null. |
[in] | aToken | The token as array of bytes. Should be null. |
|
static |
Initialize license management with license key.
License management must be initialized before the non-static methods of SignDocDocumentLoader can be used.
[in] | aKey | The license key as string. |
[in] | aProduct | Should be null. |
[in] | aVersion | Should be null. |
[in] | aToken | The token as array of bytes. Should be null. |
|
static |
Flag for setFlags(): map input file into memory.
If this flag is set, loadFromFile() and other functions will try to map their input file into memory. Doing that may improve performance (on Android, in particular) but read errors and truncating the file will crash the process.
This flag is just a hint and may be ignored.
|
static |
Specify which expiry date shall be used by getRemainingDays(): Use the expiry date for the product.
|
static |
Specify which expiry date shall be used by getRemainingDays(): Use the expiry date for signing documents.