These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Acrobat signature field automation and setting its properties

frleong
Registered: Apr 23 2007
Posts: 6

Hello, I am trying to automate the signature field creation process using OLE Automation. I can create the signature field using AFORMAUTLib. But I'd like to set the "Sign" options to mark some fields as read-only after signing. It's easy to do manually, but I'd like to automate this process.
 
However, I got the following problem. After adding a blank signature field, I tried to get the Lock object using Javascript as follows (VB.NET):
 
---
field = acroForm.Add("Signature1", "signature", 0, 0, 10, 200, 80)
 
Dim signscript As String
 
signscript = "var f = this.getField('Signature1'); var oLock = f.getLock(); app.alert(oLock);"
 
acroForm.ExecuteThisJavascript(signscript)
----
 
The problem is that f.getLock() returns null instead of a lock object. Can anyone give me some help to see what is wrong? Thanks!

My Product Information:
Acrobat Pro 7.0.9, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
It returns null because there are no lock properties associated with the field. The "setLock()" function needs to be called first. Unfortunately "setLock()" is a privileged funtion, you're not going to be able to call it directly from the VB script.

One way to get around this problem is to place all code for creating and setting up the signature field into a trusted function in a folder level script. Then call the trusted function from the VB app.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

acancell
Registered: Oct 5 2007
Posts: 17
Hi, is it possible to do a similar thing using AppleScript? Which command shuld be used to tell Acrobat to insert a signature field in a document?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, AppleScript on the MAC is used in exactly the same way.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

acancell
Registered: Oct 5 2007
Posts: 17
Can you please explain what command should I use on the Mac, I cannot find anything suitable in the dictionary of the application. I have also tried the IACReference but with no result. Thank you.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You might be out of luck on this one. On the PC there is a strong connection between the IAC and Acrobat JavaScript. It looks like the MAC doesn't have this connection. But there is a way around the problem. Setup your JavaScript function to be run from a menu item. Use app.addMenuItem(). Then execute the menu item from the IAC using AppleScript. I know that this can be done. Unfortunatly there isn't a way to pass in parameters.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

acancell
Registered: Oct 5 2007
Posts: 17
Great, it really works!! Thks a lot. Amerigo.
Nita
Registered: Jan 2 2007
Posts: 10
Just curious.... under what circumstance would you need to create this kind of field?
acancell
Registered: Oct 5 2007
Posts: 17
We want to replace paper documents, that nowadays are signed by hand by our officers, with electronic ones, and a digital signature on an pdf file is accepted for this purpose by the italian law (provided that the digital ID is issued by an accredited certification authority).