Create SignDocDocument objects. More...
Public Member Functions | |
SignDocDocumentLoader () throws SignDocException | |
Constructor. | |
synchronized SignDocDocument | loadFromMemory (byte[] aData) throws SignDocException |
Load a document from memory. | |
synchronized SignDocDocument | loadFromFile (String aPath, boolean aWritable) throws SignDocException |
Load a document from a file. | |
synchronized SignDocDocument | createPDF (int aMajor, int aMinor) throws SignDocException |
Create an empty PDF document. | |
synchronized SignDocDocument | createPDFA (int aMajor, int aMinor, String aConformance, byte[] aICC) throws SignDocException |
Create an empty PDF/A document. | |
synchronized int | ping (java.io.InputStream aStream) throws SignDocException |
Check if a document is supported by this handler. | |
synchronized void | loadFontConfigFile (String aPath) throws SignDocException |
Load font configuration from a file. | |
synchronized void | loadFontConfigEnvironment (String aName) throws SignDocException |
Load font configuration from files specified by an environment variable. | |
synchronized void | loadFontConfigStream (java.io.InputStream aStream, String aDirectory) throws SignDocException |
Load font configuration from a stream. | |
synchronized void | loadPdfFontConfigFile (String aPath) throws SignDocException |
Load font configuration for PDF documents from a file. | |
synchronized void | loadPdfFontConfigEnvironment (String aName) throws SignDocException |
Load font configuration for PDF documents from files specified by an environment variable. | |
synchronized void | loadPdfFontConfigStream (java.io.InputStream aStream, String aDirectory) throws SignDocException |
Load font configuration for PDF documents from a stream. | |
synchronized String[] | getFailedFontFiles () throws SignDocException |
Get the pathnames of font files that failed to load for the most recent loadFontConfig*() or loadPdfFontConfig*() call. | |
synchronized void | loadTrustedCertificatesFromFile (String aPath) throws SignDocException |
Load trusted root CA certifcates from a file. | |
synchronized void | loadTrustedCertificatesFromStream (java.io.InputStream aStream) throws SignDocException |
Load trusted root CA certifcates from a stream. | |
synchronized void | setFlags (int aFlags) throws SignDocException |
Set flags modifying the behavior of this SignDocDocumentLoader object and of the SignDocDocument objects created by it. | |
Static Public Member Functions | |
static void | initLicenseManager (int aWho1, int aWho2) throws SignDocException |
Initialize license management. | |
static void | setLicenseKey (byte[] aKey, String aProduct, String aVersion, byte[] aToken) throws SignDocException |
Initialize license management with license key. | |
static void | setLicenseKey (String aKey, String aProduct, String aVersion, byte[] aToken) throws SignDocException, java.io.UnsupportedEncodingException |
Initialize license management with license key. | |
static int | getRemainingDays (int aWhat) throws SignDocException |
Get the number of days until the license will expire. | |
static byte[] | generateLicenseToken (String aProduct) throws SignDocException |
Generate a license token for other SDKs also covered by the license key passed to setLicenseKey(). | |
static String | getInstallationCode () throws SignDocException |
Get the installation code needed for creating a license file. | |
static String | getVersionNumber () throws SignDocException |
Get the version number of SignDoc SDK. | |
static String | getComponentVersionNumber (String aComponent) throws SignDocException |
Get the version number of a SignDoc SDK component. | |
static int | getLicenseTextCount () throws SignDocException |
Get the number of license texts. | |
static String | getLicenseText (int aIndex) throws SignDocException |
Get a license text. | |
static void | initLogging (String aLevel, String aPathname, boolean aSetEnv) throws SignDocException |
Initialize logging. | |
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. | |
static final int | rd_signing = 1 |
Specify which expiry date shall be used by getRemainingDays(): Use the expiry date for signing documents. | |
static final int | f_map_into_memory = 0x01 |
Flag for setFlags(): map input file into memory. | |
Protected Member Functions | |
void | finalize () throws Throwable |
Finalize this object. | |
Static Package Functions | |
[static initializer] | |
Static initializer. |
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.
de.softpro.doc.SignDocDocumentLoader.SignDocDocumentLoader | ( | ) | throws SignDocException |
Constructor.
de.softpro.doc.SignDocDocumentLoader.[static initializer] | ( | ) | [static, package] |
Static initializer.
Loads the implementation DLL.
synchronized SignDocDocument de.softpro.doc.SignDocDocumentLoader.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 de.softpro.doc.SignDocDocumentLoader.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:
For instance, use "2B" for PDF/A-2b. |
[in] | aICC | The ICC profile of the PDF/A output intent or null if no output intent shall be added to the document. |
void de.softpro.doc.SignDocDocumentLoader.finalize | ( | ) | throws Throwable [protected] |
Finalize this object.
Do not call this method unless you know what you are doing.
static byte [] de.softpro.doc.SignDocDocumentLoader.generateLicenseToken | ( | String | aProduct ) | throws SignDocException [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 String de.softpro.doc.SignDocDocumentLoader.getComponentVersionNumber | ( | String | aComponent ) | throws SignDocException [static] |
Get the version number of a SignDoc SDK component.
[in] | aComponent | The component. Currently supported are "sppdf", "splm2", and "spooc". |
synchronized String [] de.softpro.doc.SignDocDocumentLoader.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 String de.softpro.doc.SignDocDocumentLoader.getInstallationCode | ( | ) | throws SignDocException [static] |
Get the installation code needed for creating a license file.
static String de.softpro.doc.SignDocDocumentLoader.getLicenseText | ( | int | aIndex ) | throws SignDocException [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 int de.softpro.doc.SignDocDocumentLoader.getLicenseTextCount | ( | ) | throws SignDocException [static] |
Get the number of license texts.
SignDoc SDK includes several Open Source components. You can retrieve the license texts one by one.
static int de.softpro.doc.SignDocDocumentLoader.getRemainingDays | ( | int | aWhat ) | throws SignDocException [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 String de.softpro.doc.SignDocDocumentLoader.getVersionNumber | ( | ) | throws SignDocException [static] |
Get the version number of SignDoc SDK.
static void de.softpro.doc.SignDocDocumentLoader.initLicenseManager | ( | int | aWho1, |
int | aWho2 | ||
) | throws SignDocException [static] |
Initialize license management.
License management must be initialized before the non-static methods of SignDocDocumentLoader can be used.
[in] | aWho1 | The first magic number for the product. |
[in] | aWho2 | The second magic number for the product. |
static void de.softpro.doc.SignDocDocumentLoader.initLogging | ( | String | aLevel, |
String | aPathname, | ||
boolean | aSetEnv | ||
) | throws SignDocException [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 de.softpro.doc.SignDocDocumentLoader.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 de.softpro.doc.SignDocDocumentLoader.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 de.softpro.doc.SignDocDocumentLoader.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 de.softpro.doc.SignDocDocumentLoader.loadFromFile | ( | String | aPath, |
boolean | aWritable | ||
) | throws SignDocException |
Load a document from a file.
Signing the document will overwrite the document, but see integer parameter "Optimize" 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_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.
[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 de.softpro.doc.SignDocDocumentLoader.loadFromMemory | ( | byte[] | aData ) | throws SignDocException |
Load a document from memory.
[in] | aData | Blob representing the document. The data must not be modified. |
synchronized void de.softpro.doc.SignDocDocumentLoader.loadPdfFontConfigEnvironment | ( | String | aName ) | throws SignDocException |
Load font configuration for PDF documents from files specified by an environment variable.
Additional fonts may be required for rendering PDF documents. The font configuration for PDF documents contains mappings from font names to font files. See section Font Configuration.
The font configuration for 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 de.softpro.doc.SignDocDocumentLoader.loadPdfFontConfigFile | ( | String | aPath ) | throws SignDocException |
Load font configuration for PDF documents from a file.
Additional fonts may be required for rendering PDF documents. The font configuration for PDF documents contains mappings from font names to font files. See section Font Configuration.
The font configuration for 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 de.softpro.doc.SignDocDocumentLoader.loadPdfFontConfigStream | ( | java.io.InputStream | aStream, |
String | aDirectory | ||
) | throws SignDocException |
Load font configuration for PDF documents from a stream.
Additional fonts may be required for rendering PDF documents. The font configuration for PDF documents contains mappings from font names to font files. See section Font Configuration.
The font configuration for 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 de.softpro.doc.SignDocDocumentLoader.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() and loadTrustedCertificatesFromStream() are cumulative.
[in] | aPath | The pathname of the file. |
synchronized void de.softpro.doc.SignDocDocumentLoader.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 de.softpro.doc.SignDocDocumentLoader.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 void de.softpro.doc.SignDocDocumentLoader.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 void de.softpro.doc.SignDocDocumentLoader.setLicenseKey | ( | byte[] | aKey, |
String | aProduct, | ||
String | aVersion, | ||
byte[] | aToken | ||
) | throws SignDocException [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 void de.softpro.doc.SignDocDocumentLoader.setLicenseKey | ( | String | aKey, |
String | aProduct, | ||
String | aVersion, | ||
byte[] | aToken | ||
) | throws SignDocException, java.io.UnsupportedEncodingException [static] |
Initialize license management with license key.
License management must be initialized before SignDocDocument.renderPageAsImage() and SignDocDocument.addSignature() 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. |
final int de.softpro.doc.SignDocDocumentLoader.f_map_into_memory = 0x01 [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.
final int de.softpro.doc.SignDocDocumentLoader.rd_product = 0 [static] |
Specify which expiry date shall be used by getRemainingDays(): Use the expiry date for the product.
final int de.softpro.doc.SignDocDocumentLoader.rd_signing = 1 [static] |
Specify which expiry date shall be used by getRemainingDays(): Use the expiry date for signing documents.