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

The 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 in the signature options.

from nutrient import PdfSigner

Methods

sign

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

Applies an invisible digital signature to a PDF document.

Parameters:

NameTypeDescription
input_pathstrThe path to the input PDF file.
output_pathstrThe path where the signed PDF will be saved.
optionsDigitalSignatureOptionsThe digital signature options including certificate and metadata.

Raises:

  • NutrientArgumentNullException: Thrown when , , or is null.
  • ArgumentException: Thrown when no certificate is provided in the options.
  • SdkException: Thrown when the signing operation fails.

sign_field

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

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

Parameters:

NameTypeDescription
input_pathstrThe path to the input PDF file.
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.

Raises:

  • NutrientArgumentNullException: Thrown when , , or is null.
  • ArgumentException: Thrown when neither certificate nor appearance is provided.
  • SdkException: Thrown when the signing operation fails or the field is not found.