pdftools_sdk.sign.signer

Module Attributes

WarningFunc

Event for non-critical errors occurring during signature processing

Classes

Signer()

Process signatures and signature fields

pdftools_sdk.sign.signer.WarningFunc

Event for non-critical errors occurring during signature processing

Parameters:

alias of Callable[[str, WarningCategory, str], None]

class pdftools_sdk.sign.signer.Signer[source]

Bases: _NativeObject

Process signatures and signature fields

__init__()[source]
sign(document: Document, configuration: SignatureConfiguration, stream: IOBase, output_options: OutputOptions | None = None) Document[source]

Add a document signature

Document signatures are sometimes also called approval signatures. This type of signature lets you verify the integrity of the signed part of the document and authenticate the signer’s identity.

The features and format of the signature are defined by the pdftools_sdk.crypto.providers.provider.Provider and the configuration.

Non-critical processing errors raise a pdftools_sdk.sign.signer.WarningFunc() . It is recommended to review the pdftools_sdk.sign.warning_category.WarningCategory and handle them if necessary for the application.

Parameters:
Returns:

The signed document

Return type:

pdftools_sdk.pdf.document.Document

Raises:
certify(document: Document, configuration: SignatureConfiguration, stream: IOBase, permissions: MdpPermissionOptions | None = None, output_options: OutputOptions | None = None) Document[source]

Add a document certification signature

This type of signature lets you detect rejected changes specified by the author. These signatures are also called Modification Detection and Prevention (MDP) signatures. The allowed permissions are defined by permissions.

The features and format of the signature are defined by the pdftools_sdk.crypto.providers.provider.Provider and the configuration.

Non-critical processing errors raise a pdftools_sdk.sign.signer.WarningFunc() . It is recommended to review the pdftools_sdk.sign.warning_category.WarningCategory and handle them if necessary for the application.

Parameters:
Return type:

pdftools_sdk.pdf.document.Document

Raises:
add_timestamp(document: Document, configuration: TimestampConfiguration, stream: IOBase, output_options: OutputOptions | None = None) Document[source]

Add a document time-stamp

This type of signature provides evidence that the document existed at a specific time and protects the document’s integrity.

The features and format of the signature are defined by the pdftools_sdk.crypto.providers.provider.Provider and the configuration.

Non-critical processing errors raise a pdftools_sdk.sign.signer.WarningFunc() . It is recommended to review the pdftools_sdk.sign.warning_category.WarningCategory and handle them if necessary for the application.

Parameters:
Return type:

pdftools_sdk.pdf.document.Document

Raises:
add_signature_field(document: Document, options: SignatureFieldOptions, stream: IOBase, output_options: OutputOptions | None = None) Document[source]

Add an unsigned signature field

Add an unsigned signature field that can later be signed (see pdftools_sdk.pdf.unsigned_signature_field.UnsignedSignatureField ).

Non-critical processing errors raise a pdftools_sdk.sign.signer.WarningFunc() . It is recommended to review the pdftools_sdk.sign.warning_category.WarningCategory and handle them if necessary for the application.

Parameters:
Return type:

pdftools_sdk.pdf.document.Document

Raises:
add_prepared_signature(document: Document, configuration: SignatureConfiguration, stream: IOBase, output_options: OutputOptions | None = None) PreparedDocument[source]

Add a prepared signature

Adding a prepared signature is only required in very particular or specialized use cases. This method is the same as pdftools_sdk.sign.signer.Signer.sign() , but without actually creating the cryptographic signature. The cryptographic signature can be inserted later using pdftools_sdk.sign.signer.Signer.sign_prepared_signature() .

While the configuration can be created by any pdftools_sdk.crypto.providers.provider.Provider , it is typically created by pdftools_sdk.crypto.providers.built_in.provider.Provider.create_prepared_signature() .

Parameters:
Return type:

pdftools_sdk.sign.prepared_document.PreparedDocument

Raises:
sign_prepared_signature(document: Document, configuration: SignatureConfiguration, stream: IOBase) Document[source]

Sign a prepared signature

Sign a document that contains a prepared signature created using pdftools_sdk.sign.signer.Signer.add_prepared_signature() . Note that the configuration must be compatible to the configuration used when preparing the signature.

Parameters:
Return type:

pdftools_sdk.pdf.document.Document

Raises:
process(document: Document, stream: IOBase, output_options: OutputOptions | None = None, provider: Provider | None = None) Document[source]

Process a document

Apply document-level processing options without any signature operation. For example:

Non-critical processing errors raise a pdftools_sdk.sign.signer.WarningFunc() . It is recommended to review the pdftools_sdk.sign.warning_category.WarningCategory and handle them if necessary for the application.

Parameters:
Return type:

pdftools_sdk.pdf.document.Document

Raises:
add_warning_handler(handler: Callable[[str, WarningCategory, str], None]) None[source]

Add handler for the WarningFunc() event.

Parameters:

handler – Event handler. If a handler is added that is already registered, it is ignored.

remove_warning_handler(handler: Callable[[str, WarningCategory, str], None]) None[source]

Remove registered handler of the WarningFunc() event.

Parameters:

handler – Event handler that shall be removed. If a handler is not registered, it is ignored.