This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /api/python/signing/signature.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Signature

Provides functionality for signing PDF documents. Supports both digital signatures (with certificate) and electronic signatures (visual only).

The Signature class enables adding signatures to PDF documents: Digital signatures use PFX/P12 certificates to cryptographically sign the document.Electronic signatures add visual representation (image/text) without cryptographic signing. For PAdES-B compliance, use CAdES signature mode (the default). For PAdES-T compliance, configure a TimestampConfiguration in the signature options.

from nutrient_sdk import Signature

Construction

Signature()

Creates a new Signature instance with default settings.

Methods

add_document_timestamp

def add_document_timestamp(self, document: Document, output_path: str, timestamp: TimestampConfiguration) -> None

Appends a document timestamp to a document, protecting its current state and its validation material.

Parameters:

NameTypeDescription
documentDocumentThe document to timestamp.
output_pathstrThe path where the updated PDF will be saved.
timestampTimestampConfigurationThe timestamp authority configuration.

add_ltv_information

def add_ltv_information(self, document: Document, output_path: str) -> None

Adds long-term validation material — certificates and revocation information — for all signed signatures of a document, upgrading it toward PAdES B-LT.

Parameters:

NameTypeDescription
documentDocumentThe signed document to add validation material to.
output_pathstrThe path where the updated PDF will be saved.

finish_signature

def finish_signature(self, prepared_document: Document, output_path: str, signed_data: list, options: DigitalSignatureOptions) -> None

Completes external signing (phase two) with a raw signature value produced by an external signer.

Parameters:

NameTypeDescription
prepared_documentDocumentThe prepared document returned by PrepareSignature.
output_pathstrThe path where the signed PDF will be saved.
signed_datalistThe raw signature value over the prepared bytes.
optionsDigitalSignatureOptionsThe digital signature options with the same certificate used to prepare.

finish_signature_with_cms

def finish_signature_with_cms(self, prepared_document: Document, output_path: str, signature_container: list) -> None

Completes external signing (phase two) with a complete signature container produced by an external signing service.

Parameters:

NameTypeDescription
prepared_documentDocumentThe prepared document.
output_pathstrThe path where the signed PDF will be saved.
signature_containerlistThe complete, DER-encoded CMS signature container.

prepare_signature

def prepare_signature(self, document: Document, output_path: str, options: DigitalSignatureOptions) -> list

Starts external signing (phase one): prepares the document with a signature placeholder and returns the exact bytes an external signer must sign.

Parameters:

NameTypeDescription
documentDocumentThe document to prepare for signing.
output_pathstrThe path where the prepared PDF will be saved.
optionsDigitalSignatureOptionsThe digital signature options, including the signing certificate.

Returns: list - The bytes to be signed by the external signer.


sign

def sign(self, document: Document, output_path: str, options: DigitalSignatureOptions) -> None

Applies an invisible digital signature to a document.

Parameters:

NameTypeDescription
documentDocumentThe document to sign.
output_pathstrThe path where the signed PDF will be saved.
optionsDigitalSignatureOptionsThe digital signature options including certificate and metadata.

sign_field

def sign_field(self, document: Document, output_path: str, field_name: str, options: DigitalSignatureOptions, appearance: SignatureAppearance) -> None

Applies a signature to a document using an existing signature field. Supports both digital signatures (with certificate) and electronic signatures (visual only).

Parameters:

NameTypeDescription
documentDocumentThe document to sign.
output_pathstrThe path where the signed PDF will be saved.
field_namestrThe name of the existing signature form field to use for the signature.
optionsDigitalSignatureOptionsThe digital signature options. Can be null for electronic signatures.
appearanceSignatureAppearanceThe visual appearance of the signature.