Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Community Beginner ,
Dec 03, 2018 Dec 03, 2018

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
1.7K
Translate
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 Expert ,
Dec 03, 2018 Dec 03, 2018

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

Translate
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

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.

Translate
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 Expert ,
Dec 03, 2018 Dec 03, 2018

Yes, by using the encryptUsingPolicy method of the Document object. Read that method's documentation for the full details and some examples.

Translate
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

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

});

Translate
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 Expert ,
Dec 04, 2018 Dec 04, 2018

Why do you use flattenPages in a trusted function?

Translate
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 Expert ,
Dec 04, 2018 Dec 04, 2018

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.

Translate
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
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.

Translate
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