Sub SignPDF()
On Error GoTo Err_Handler
Dim pdfPDDoc As New AcroPDDoc, oJS As Object, oSign As Object, oPpklite As Object, oFields As Object
Dim strFName1 As String, strFName2 As String, strSignFName As String
Dim oSignInfo As Object, strSecInfo As String
Dim oParam As Parameter
strSignFName = "C:\mySignature.pfx"
strFName1 = "C:\myPdf.pdf"
strFName2 = "C:\myPdf-signed.pdf"
Set pdfPDDoc = CreateObject("AcroExch.PDDoc")
If pdfPDDoc.Open(strFName1) Then
Set oJS = pdfPDDoc.GetJSObject
Set oFields = oJS.AddField("SignatureField", "signature", 0, Array(350, 800, 500, 750))
Set oSign = oJS.GetField("SignatureField")
Set oPpklite = oJS.security.getHandler("Adobe.PPKLite", True)
oPpklite.login "{'myPasswd', '" & strSignFName & "'}"
oSign.signatureSign oPpklite
pdfPDDoc.Save 1, strFName2
oPpklite.logout
End If
Exit_Proc:
Exit Sub
Err_Handler:
MsgBox "In test" & vbCrLf & Err.Number & "--" & Err.Description
Resume Exit_Proc
End Sub