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!
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