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

Can not delete pages while signing document

Beans
Registered: Mar 8 2011
Posts: 7

Hello, I am fresh out of the womb and into the Acro Scripting world. I have been able to fumble my way into figuring out:
 
this.deletePages({nStart:this.numPages-2, nEnd:this.numPages-2})

and
 
this.mailDoc(true,"To", "CC", "BC", "Subject", "Body-Message");
 
I was able to make a signature field perform these "operations"(please tell me if that is the wrong term), in 7 Standard. Now that I have Pro X, I get the following message, from the Console:
 
"RaiseError: This operation is not permitted.
Doc.deletePages:5:Field Signature1:Format
===> This operation is not permitted."
  
I can only suspect that I am now doing this wrong or Pro X does not permit this because of revised security(over 7 Standard).
 
My intentions are to construct a cover document, that will perform these actions, and combine it with other PDF support documents(emails, etc).
 
You help is appreciated.

My Product Information:
Acrobat, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You are correct that Acrobat 10 has much tighter security than 7, especially where signatures are concerned. However, the format event of a signature field was probably not the best place to put an operation that modifies the PDF. The delete must be done before the document is signed, and the format event would most likely occur during or after the signature is applied to the PDF. Try putting the delete on the delete on the Mouse down event.

Another way to do this is to drive the entire process from a Button. Then you could write a script that performs the operations, Delete, Sign, Email. In the proper order.

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

Beans
Registered: Mar 8 2011
Posts: 7
thomp wrote:
The delete must be done before the document is signed, and the format event would most likely occur during or after the signature is applied to the PDF. Try putting the delete on the delete on the Mouse down event.Another way to do this is to drive the entire process from a Button. Then you could write a script that performs the operations, Delete, Sign, Email. In the proper order.
Hi Thom,

I toyed with the button idea and am able to get the signature to apply; when executed in the Console. I however get the following error when attempting to perform the action:

"NotAllowedError: Security settings prevent access to this property or method.
Field.signatureSign:2:Field Button2:Mouse Up"

This suggests, to me, that signing through the use of a button can be done. I need to figure out how to "Allow" this action to take effect upon a "Mouse Up/Down."

*I appologize if this topic, now does not belong in this forum.

The JS Developer Guide is leading me to the JS for Acrobat API Reference- "Safe Paths". It looks like I need to probably do something with "myTrustedFunction...."???

Wow, out of the pan and in to the fire. I might just have to resort to a little less automation and make for my ability to delete before signing and sending the form to the next recipient(the one that does not need to be privy to my supporting documents).

Love your instructionals, Thom.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
If the signing script does not specify the save location or the digital signature then there should not be a security issue. What is your code for performing the signing?

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

Beans
Registered: Mar 8 2011
Posts: 7
thomp wrote:
If the signing script does not specify the save location or the digital signature then there should not be a security issue. What is your code for performing the signing?
"Button2 =this.getField("Signature1");
Button2.signatureSign({});"

I've just tried the app.trustedFunction and get the following from the console:

"NotAllowedError: Security settings prevent access to this property or method.
App.trustedFunction:2:Field Button2:Mouse Up"

Thank you for your help.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Ok, my fault. I went back and looked over the material on digital signature fields and you can't call "signatureSign" from inside a document script. You are correct in trying to use a trusted function, but a trusted function can only be created from a folder level script. If your workflow will allow for a folder level script then you are in luck. Otherwise your only option for making this work in a single operation would be to use the MouseDown event to delete the pages.

Does it need to be a single operation? Could it be a two step process?

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