PdfSigner
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 PdfSignerMethods
sign
def sign(self, input_path: str, output_path: str, options: DigitalSignatureOptions) -> NoneApplies an invisible digital signature to a PDF document.
Parameters:
| Name | Type | Description |
|---|---|---|
input_path | str | The path to the input PDF file. |
output_path | str | The path where the signed PDF will be saved. |
options | DigitalSignatureOptions | The 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) -> NoneApplies a signature to a PDF document using an existing signature field. Supports both digital signatures (with certificate) and electronic signatures (visual only).
Parameters:
| Name | Type | Description |
|---|---|---|
input_path | str | The path to the input PDF file. |
output_path | str | The path where the signed PDF will be saved. |
field_name | str | The name of the existing signature form field to use for the signature. |
options | DigitalSignatureOptions | The digital signature options. Can be null for electronic signatures. |
appearance | SignatureAppearance | The 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.