SignFile

Security and Signatures

Description

Applies a digital signature to a PDF document on disk.

The signing identity must be in PKCS#12 format containing a certificate and private key.

Syntax

Delphi

function TPDFlib.SignFile(Const InputFileName, OpenPassword, SignatureFieldName, OutputFileName, PFXFileName, PFXPassword, Reason, Location, ContactInfo: WideString): Integer;

ActiveX

Function PDFlib::SignFile(InputFileName As String, OpenPassword As String, SignatureFieldName As String, OutputFileName As String, PFXFileName As String, PFXPassword As String, Reason As String, Location As String, ContactInfo As String) As Long

Parameters

InputFileNameThe path and file name of the input PDF to sign.
OpenPasswordThe optional password to open the input PDF if it is encrypted
SignatureFieldNameThe name of the signature field to sign. If a field with this name does not exist it will be created. This field cannot be blank.
OutputFileNameThe path and file name of the signed PDF that should be created. This should be a different file to InputFileName. If in place signing is required (overwriting the original file) then this parameter should be left blank.
PFXFileNameThe path and name of the PKCS#12 certificate/private key file (.pfx file). The password to open the PFX file.
PFXPasswordAn optional string indicating the reason for signing.
Reason
LocationAn optional string indicating the location that the signing was done.
ContactInfoAn optional string indicating the contact information of the signer.

Return values

1The file was signed successfully 2 Input PDF not found 3 Input PDF cannot be read Input PDF password incorrect 4 5 Certificate file not found 6 Certificate file is invalid 7 Incorrect certificate password 8 Unknown certificate format No private key found in certificate file 9 10 Could not write output file 11 Could not apply signature The signature field name was blank 12