oMaking an editable PDF Form non-editable using a java script
Copy link to clipboard
Copied
Hello Everyone,
I am new the forums here.
I need assistance with creating a script shortcut that would make the PDF non-editable.
In a way, i require a shortcut of instead of going to settings to make the PDF non-editable, i would like to use a script instead.
Any ideas?
Thank you.
Copy link to clipboard
Copied
"Non-editable" can mean a lot of things. Please clarify what exactly you mean by it. What commands are you currently using to get it to that state?
Copy link to clipboard
Copied
Hello try67,
Thank you for your fast reply.
so far we have been doing it this way:
1. At the top right in Acrobat, click the Tools pane. Open the Protection panel.
2. Click Encrypt, and select Encrypt With Password. Confirm that you want to change the security of the
document.
3. In the Password Security Settings dialog box, you can add two types of passwords.
Is there a way to make this into a Java script instead?
Thank you.
Copy link to clipboard
Copied
Yes, by using the encryptUsingPolicy method of the Document object. Read that method's documentation for the full details and some examples.
Copy link to clipboard
Copied
Yes that would be the manual way of encrypting.
I am looking for a Javascript method where i can just click to have the file automatically encrypted.
e.g we use this script to flatten the PDFs
var myFlatten = app.trustedFunction(function(doc) {
app.beginPriv();
doc.flattenPages({
});
app.endPriv();
});
app.addToolButton(
{
cName: "ToolbarFlatten",
cLabel: "Flatten",
cExec: "myFlatten(this);",
cEnable: "event.rc = app.doc;"
});
Copy link to clipboard
Copied
Why do you use flattenPages in a trusted function?
Copy link to clipboard
Copied
Why do you say it's a "manual" way of doing it? It can be fully automated, if you provide a SecurityPolicy object as the first parameter.
Copy link to clipboard
Copied
Hi Try67,
My apologies, i am very new when it comes to scripting for adobe. Could you please kindly point me towards the right directlon on how to make it fully automated? or if you could please provide me with the steps to recreate it on my side.
Thank you.

