signField

public final void signField(Document document, String outputPath, String fieldName, DigitalSignatureOptions options, SignatureAppearance appearance)

Applies a signature to a document using an existing signature field. Supports both digital signatures (with certificate) and electronic signatures (visual only). The behavior depends on what is provided: Certificate + Appearance: Digital signature with custom visual appearance.Certificate only: Digital signature with auto-generated appearance from metadata.Appearance only: Electronic signature (visual only, field is replaced with image/text). Not supported on password-protected documents, whose protection the re-saved output could not preserve.Neither: Throws ArgumentException. If the document is not in PDF format and implicit conversion is enabled in the document settings, it will be automatically converted to PDF before signing. If the document was opened with a password through its open settings, that password is applied automatically so password-protected PDFs can be signed.

Parameters

document

The document to sign.

outputPath

The path where the signed PDF will be saved.

fieldName

The name of the existing signature form field to use for the signature.

options

The digital signature options. Can be null for electronic signatures.

appearance

The visual appearance of the signature.


public final void signField(Document document, FileOutputStream output, String fieldName, DigitalSignatureOptions options, SignatureAppearance appearance)

Applies a signature to a document using an existing signature field, writing the result to a stream. Supports both digital signatures (with certificate) and electronic signatures (visual only). The behavior depends on what is provided: Certificate + Appearance: Digital signature with custom visual appearance.Certificate only: Digital signature with auto-generated appearance from metadata.Appearance only: Electronic signature (visual only, field is replaced with image/text). Not supported on password-protected documents, whose protection the re-saved output could not preserve.Neither: Throws ArgumentException. If the document is not in PDF format and implicit conversion is enabled in the document settings, it will be automatically converted to PDF before signing. If the document was opened with a password through its open settings, that password is applied automatically so password-protected PDFs can be signed.

Parameters

document

The document to sign.

output

The output stream where the signed PDF will be written.

fieldName

The name of the existing signature form field to use for the signature.

options

The digital signature options. Can be null for electronic signatures.

appearance

The visual appearance of the signature.