Forgot to mention what the Error is: The debug window says: "doc.encryptUsingPolicy ist not a function"
From where are you calling this method?
In Fact the script is invoked if I open a pdf-file with acrobat.
1 person found this helpful
So the script is launched when Acrobat is opened, not through a menu item or
a toolbar icon? That's not good.
When Acrobat is opened and the folder-level scripts are launched there
aren't any documents open yet (even if you open it by double-clicking a
PDF), so "this" doesn't point to any document. It probably is just null at
You need to either launch the script from a menu item that calls this
function, or from a document-level script that launches when the file is
Ok, I understand that.
In this case the code above is the complete wrong approach to what I want.
Refering to the title of this discussion:
I want to encrypt every pdf document which is saved with a standard password. This should happen without any user interaction.
Is that possible to do ?
I don't think you're that off, actually. However, I can't give you a
definite answer if it's possible, because I didn't really examine your code
and there might be some security issues.
What I suggest you do is the following: leave the code as it is, except for
the last line, the one that calls the function.
This line needs to be placed in a document's WillSave event. That will cause
your code to launch just before the file is saved.
You can set this event by opening a PDF, going to Advanced - Document
Processing - Set Document Actions.