I am new to both these forums and to automating PDF. I have Acrobat 8.1.0 Professional. What I need help with is to find code (complete procedure(s) and any special references) for automatically adding digital signatures to a PDF file.
This program is to be implemented in VBA to be launched from an Access database and add a signature that is previous created to a form printed to PDF. Since this is an app for my work group, using third party software is not an option - I have to custom build this function in the database (if it is possible to be done). Plus I have no experience with JavaScript.
I have been researching this on the net for the past week and have only come across a couple of snippets of code which were reported as working, but haven't worked for me. By not working I mean that the code will add a signature box, but when I use:
"oSign.signatureSign" or
"oSign.signatureSign PPKLite" with PPKLite "Set PPKLite = jso.security.getHandler("Adobe.PPKLite", False)" or "Set PPKLite = jso.security.getHandler("Adobe.PPKLite", True)"
the PDF file doesn't have the signature added and there are no problems when I debug the code and no messages appear when it is run - just no signature.
For reference, I am including a copy of a sub that I am testing to accomplish my task:
Sub PDFSig()
Dim test As Boolean
Set acrobatApplication = CreateObject("AcroExch.App")
Dim gPDDoc As Acrobat.CAcroPDDoc
Set gPDDoc = CreateObject("AcroExch.PDDoc")
gPDDoc.Open Environ$("userprofile") & "\Desktop\TestFile.pdf"
Set jso = gPDDoc.GetJSObject
Set ppklite = jso.security.getHandler("Adobe.PPKLite", True)
test = ppklite.login(InputBox("Please enter your password"), "C:\Documents and Settings\josdmoor\Application Data\Adobe\Acrobat\8.0\Security\JoshuaMoore.pfx")
Set oAdd1 = jso.AddField("Action Form Preparer Signature", "signature", 0, Array(173, 175, 355, 130))
Set oSign1 = jso.GetField("Action Form Preparer Signature")
Set oAdd2 = jso.AddField("Authorized Signer", "signature", 0, Array(173, 130, 355, 86))
Set oSign2 = jso.GetField("Authorized Signer")
oSign1.signatureSign ppklite
ppklite.logout
End Sub
Apologies for the lengthy post, but it's better to give full info than not enough. Please let me know if it is possible and if so, if I could get the code (+ any special references) and any special settings in Acrobat (if any) I would be very grateful.
Thanks.
-Joshua
Yes, it is possible to sign a PDF using Acrobat JavaScript and control it through a VB app. Someone writing the code for you gratis will be a matter of someone having the time and feeling like taking that time to do it. Your request kinda goes a bit beyond the bounds of a user to user type forum- it is a developer project.
As far as references, you could start with the official Adobe Documentation for Developers including-
The JavaScript Reference-
http://www.adobe.com/devnet/acrobat/
and
The Interapplication Communication documents
http://www.adobe.com/devnet/acrobat/interapplication.php
Hope this helps,
Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com
Dimitri Munkirs
WindJack Solutions
pdfscripting.com