oMaking an editable PDF Form non-editable using a java script

Community Beginner ,
Dec 03, 2018 Dec 03, 2018

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.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

413

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 03, 2018 Dec 03, 2018

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 03, 2018 Dec 03, 2018

Copy link to clipboard

Copied

Hello try67,

Thank you for your fast reply.

so far we have been doing it this way:

https://www.adobe.com/content/dam/acom/en/products/acrobat/pdfs/adobe-acrobat-xi-protect-pdf-file-wi...

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 03, 2018 Dec 03, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 04, 2018 Dec 04, 2018

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;"

});

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 04, 2018 Dec 04, 2018

Copy link to clipboard

Copied

Why do you use flattenPages in a trusted function?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 04, 2018 Dec 04, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 04, 2018 Dec 04, 2018

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines