PDA

View Full Version : Securing a PDF using Excel VBA



Macrosian
11-14-2011, 09:25 PM
I got the script reference encryptUsingPolicy from Adobe API references, But don't know how to include it in the VBA, Please advice. I have already created a security policy to protect the document
This is an example from API Guide


var doc = app.newDoc();
var policy = security.chooseSecurityPolicy();
var results = doc.encryptUsingPolicy( { oPolicy: policy } );
if ( results.errorCode == 0)
console.println("The policy applied was: " + results.policyApplied.name);

Macrosian
11-15-2011, 01:26 AM
Got this also..
Set pdfDoc1 = CreateObject("AcroExch.PDDoc")
Set jsObj = pdfDoc1.GetJSObject
jsObj.encryptUsingPolicy jsObj.Security.chooseSecurityPolicy()

But asking for my policies and manually select one...How can I automate the selection (Only 1 defined policy)

Macrosian
11-16-2011, 12:58 AM
Any help appreciated...