SignDoc SDK (.NET without exceptions)
5.0.0
|
Create SignDocDocument objects. More...
Public Member Functions | |
~SignDocDocumentLoader () | |
Destructor. More... | |
!SignDocDocumentLoader () | |
Finalizer. More... | |
SignDocDocumentLoader () | |
Constructor. More... | |
SignDocDocument | loadFromMemory (out ReturnCode aReturnCode, byte[] aData) |
Load a document from memory. More... | |
SignDocDocument | loadFromFile (out ReturnCode aReturnCode, string aPath, bool aWritable) |
Load a document from a file. More... | |
SignDocDocument | createPDF (out ReturnCode aReturnCode, int aMajor, int aMinor) |
Create an empty PDF document. More... | |
SignDocDocument | createPDFA (out ReturnCode aReturnCode, int aMajor, int aMinor, string aConformance, byte[] aICC) |
Create an empty PDF/A document. More... | |
DocumentType | ping (InputStream aStream) |
Check if a document is supported by this handler. More... | |
DocumentType | pingMemory (byte[] aBlob) |
Check if a document is supported by this handler. More... | |
bool | loadFontConfigFile (string aPath) |
Load font configuration from a file. More... | |
bool | loadFontConfigEnvironment (string aName) |
Load font configuration from files specified by an environment variable. More... | |
bool | loadFontConfigStream (InputStream aStream, string aDirectory) |
Load font configuration from a stream. More... | |
bool | loadFontConfigBlob (byte[] aBlob, string aDirectory) |
Load font configuration from a blob. More... | |
bool | loadPdfFontConfigFile (string aPath) |
Load font configuration for rendering PDF documents from a file. More... | |
bool | loadPdfFontConfigEnvironment (string aName) |
Load font configuration for rendering PDF documents from files specified by an environment variable. More... | |
bool | loadPdfFontConfigStream (InputStream aStream, string aDirectory) |
Load font configuration for rendering PDF documents from a stream. More... | |
bool | loadPdfFontConfigBlob (byte[] aBlob, string aDirectory) |
Load font configuration for rendering PDF documents from a blob. More... | |
string[] | getFailedFontFiles () |
Get the pathnames of font files that failed to load for the most recent loadFontConfig*() or loadPdfFontConfig*() call. More... | |
bool | loadTrustedCertificatesFromFile (string aPath) |
Load trusted root CA certifcates from a file. More... | |
bool | loadTrustedCertificatesFromStream (InputStream aStream) |
Load trusted root CA certifcates from a stream. More... | |
bool | loadTrustedCertificatesFromMemory (byte[] aBlob) |
Load trusted root CA certifcates from a blob. More... | |
void | setFlags (DocumentLoaderFlags aFlags) |
Set flags modifying the behavior of this SignDocDocumentLoader object and of the SignDocDocument objects created by it. More... | |
bool | initLogging (string aLevel, string aPathname, bool aSetEnv) |
Initialize logging. More... | |
string | getErrorMessage () |
Get an error message for the last function call. More... | |
Static Public Member Functions | |
static bool | setLicenseKey (byte[] aKey, string aProduct, string aVersion, byte[] aToken) |
Initialize license management with license key. More... | |
static bool | setLicenseKey2 (string aKey, string aProduct, string aVersion, byte[] aToken) |
Initialize license management with license key. More... | |
static int | getRemainingDays (RemainingDays aWhat) |
Get the number of days until the license will expire. More... | |
static byte[] | generateLicenseToken (string aProduct) |
Generate a license token for other SDKs also covered by the license key passed to setLicenseKey(). More... | |
static string | getVersionNumber () |
Get the version number of SignDoc SDK. More... | |
static string | getComponentVersionNumber (string aComponent) |
Get the version number of a SignDoc SDK component. More... | |
static int | getLicenseTextCount () |
Get the number of license texts. More... | |
static string | getLicenseText (int aIndex) |
Get a license text. More... | |
Create SignDocDocument objects.
Use getErrorMessage() to get more information after a function call failed.
As the error message is stored in this object, each thread should have its own instance of SignDocDocumentLoader or synchronization should be used.
Unless you need differently configured SignDocDocumentLoader objects, you should have only one SignDocDocumentLoader object per process (but see above). Loading font configuration files can be expensive, in particular if many fonts have to be scanned.
Destructor.
Finalizer.
Constructor.
SignDocDocument createPDF | ( | out ReturnCode | aReturnCode, |
int | aMajor, | ||
int | aMinor | ||
) |
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.
[out] | aReturnCode | The return code, ReturnCode.OK iff successful. |
[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). |
SignDocDocument createPDFA | ( | out ReturnCode | aReturnCode, |
int | aMajor, | ||
int | aMinor, | ||
string | aConformance, | ||
byte[] | aICC | ||
) |
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.
[out] | aReturnCode | The return code, ReturnCode.OK iff successful. |
[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 empty if no output intent shall be added to the document. |
|
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". |
string getErrorMessage | ( | ) |
Get an error message for the last function call.
string [] getFailedFontFiles | ( | ) |
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 (RemainingDays.Product or RemainingDays.Signing). |
|
static |
Get the version number of SignDoc SDK.
bool initLogging | ( | string | aLevel, |
string | aPathname, | ||
bool | aSetEnv | ||
) |
Initialize logging.
This function returns false 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. |
bool loadFontConfigBlob | ( | byte[] | aBlob, |
string | aDirectory | ||
) |
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-empty, relative font pathnames will be relative to this directory. The directory must exist and must be readable. If empty, relative font pathnames will make this function fail. |
bool loadFontConfigEnvironment | ( | string | aName | ) |
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. |
bool loadFontConfigFile | ( | string | aPath | ) |
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. |
bool loadFontConfigStream | ( | InputStream | aStream, |
string | aDirectory | ||
) |
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-empty, relative font pathnames will be relative to this directory. The directory must exist and must be readable. If empty, relative font pathnames will make this function fail. |
SignDocDocument loadFromFile | ( | out ReturnCode | aReturnCode, |
string | aPath, | ||
bool | aWritable | ||
) |
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 SetFieldFlags.FontFail). 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.
[out] | aReturnCode | The return code, ReturnCode.OK iff successful. |
[in] | aPath | Pathname of the document file. |
[in] | aWritable | Open for writing (used for signing TIFF documents in place, ignored for PDF documents). |
SignDocDocument loadFromMemory | ( | out ReturnCode | aReturnCode, |
byte[] | aData | ||
) |
Load a document from memory.
[out] | aReturnCode | The return code, ReturnCode.OK iff successful. |
[in] | aData | Blob representing the document. The data must not be modified. |
bool loadPdfFontConfigBlob | ( | byte[] | aBlob, |
string | aDirectory | ||
) |
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 | The font configuration will be read from this blob. |
[in] | aDirectory | If non-empty, relative font pathnames will be relative to this directory. The directory must exist and must be readable. If empty, relative font pathnames will make this function fail. |
bool loadPdfFontConfigEnvironment | ( | string | aName | ) |
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. |
bool loadPdfFontConfigFile | ( | string | aPath | ) |
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. |
bool loadPdfFontConfigStream | ( | InputStream | aStream, |
string | aDirectory | ||
) |
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-empty, relative font pathnames will be relative to this directory. The directory must exist and must be readable. If empty, relative font pathnames will make this function fail. |
bool loadTrustedCertificatesFromFile | ( | string | aPath | ) |
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. |
bool loadTrustedCertificatesFromMemory | ( | byte[] | aBlob | ) |
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. |
bool loadTrustedCertificatesFromStream | ( | InputStream | aStream | ) |
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. |
DocumentType ping | ( | InputStream | aStream | ) |
Check if a document is supported by this handler.
[in] | aStream | A seekable stream positioned at the first octet of the document. |
DocumentType pingMemory | ( | byte[] | aBlob | ) |
Check if a document is supported by this handler.
[in] | aBlob | A blob containing the document. |
void setFlags | ( | DocumentLoaderFlags | aFlags | ) |
Set flags modifying the behavior of this SignDocDocumentLoader object and of the SignDocDocument objects created by it.
[in] | aFlags | The flags: 0 or DocumentLoaderFlags.MapIntoMemory. |
|
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 an empty string. |
[in] | aVersion | Should be an empty string. |
[in] | aToken | The token as array of bytes. Should be empty. |
|
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 an empty string. |
[in] | aVersion | Should be an empty string. |
[in] | aToken | The token as array of bytes. Should be empty. |