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

How create security envelope with javascript?

alexsander_santos
Registered: Apr 10 2009
Posts: 14

Hi.

Well. Another question. I need something like a batch process, but I belive that the only way is using javascript.

The user will do this steps:
1 - Select "Advanced > Security > Create Security Enevelope";

2 - He wil select the files to attach. The files are all PDF in a folder in the user computer. Ex: C:\SEND_FILES

3 - He wil click "Next";

4 - He will select the envelope template to use. He will allways use the same template.

5 - He wil click "Next";

6 - He will select "Send the envelope later" and click "Next";

7 - He will select a Security Policy called "ToAll" and click "Next";

8 - He will click Finish

9 - He will save the file with the name "Closed_Envelope" allways in the same folder.

The user has Adobe Acrobat 9 Standard. This script should run when the user clicks a button in the document. The files added to the envelope will be this file and the files in the step 2.

Does anyone have any idea how create it? I looker for a tool to record my moves (like Winword) the I did no found.

I really need help.

Thanks!

My Product Information:
Acrobat Standard 9.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The steps you describe are exactly the steps a user walks though when they select the "Advanced > Security > Create Security Enevelope". So, what exactly do you want the script on the document button to do? Do you want it to run this menu item?Have you looked at the "Execute a Menu Item" action on the properties dialog? You'll notice that this particular menu item is not listed. This is a security issue with Acrobat. Only a small set of harmless menu items are availible to an action/script on a PDF. There are a couple of ways around this limitation.

1) Install a folder level script on the user's system that provides a trusted function for running the menu item.

2) Modify the user's registry to include this menu item on the white list. See this Blog entry:
http://www.acrobatusers.com/blogs/thomp/security-makes-life-difficult-everyone-not-just-you

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

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

alexsander_santos
Registered: Apr 10 2009
Posts: 14
Yes, I want a script that do this, just like a batch script.

I thinked about something. Using the evelope templete, i could use javascript to includ the PDF I want and, after that, encript the file using a specific policy.

This is the same thing security envelope does, isnĀ“t it?

So, I thinked about add a button in the toolbar that, when pressed, this will:

1 - Embeds a list of all documents in a specific path in the document.

2 - Encript using policy.

3 - Sabe the document.

So, help me. To step 1, a have to use the function embedDocAsDataObject() correct? To step 2 I have to use encryptUsingPolicy() right? To step 3, saveas() right?

Some security problems in this steps?

Thanks!
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, there are security issues with these steps. If you look in the Acrobat JavaScript Reference you'll see that all 3 of these operations require privilege to run silently. Essentially, they cannot be run from a script on a document.

And you have a couple of other issues. Embedding requires a path to a specific file. Acrobat JavaScript does not provide general file system access. It cannot get all the files in a particular folder. To encrypt with a particlar security policy, the script need to know the name of the policy. Will this value be hard coded or entered by the users. Will the users all have the same policy?

The only way to do this is to create a two part Automation tool that's installed on the user's system. First, you need a folder level script that defines a function for embedding a single file and a function for applying security.

Next, you'll need to write a VB application that uses the Acrobat IAC interface to run the emebed function on all the files in a particular folder and then calls the function for applying security, and finally saves the file. This is the program the user's interact with. They don't even need to see Acrobat.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

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