Copy link to clipboard
Copied
I´m trying to create a java-instruction, that, when I press a button, save the current PDF-form under a nwe name. The name of the PDF will be fetched from a field within the PDF-form.
BUT - I can´t get the "saveAs" function to work!
I´m using the Adobe Acrobat Pro DC.
I want to use the java-command because I need to be able to name the new file from a field in the form.
I´ve been trying a couple of different syntax:
this.saveAs();
this.saveAs("file1.pdf");
event.target.saveAs();
event.target.saveAs("teat.pdf");
...
I am lead to belive that it is a problem with security, a saveAs or save function might be able to change data on the computer without the users controll. BUT - the command exists - how do I set it up to work?!
The form will later be mail to different recipients, where I need the same function to work. SO - I can´t place a script in the Java-folder since it won follow the document to the new user?!
Copy link to clipboard
Copied
Read the documentation of the saveAs method.
Info: Acrobat uses JavaScript, not Java.
Copy link to clipboard
Copied
I have - and it still do not have a solution for this to work. This obiously means that my understanding of what I´m doing isn´t as good as it need to be!
However - that is why I´m trying to seek some help here...
1) Is it possible to create a "button", and using Java-code, from the button, to initiate a saveAs command?
2) If it is - Do I have to do any set-up of the file or program/user to get this function to work? If so - how and where?
3) I´m going to use this form on both PC and tablet (Android), is it posible?
4) Where do I go wrong??!?
I´ve understod from another thread that I need to have a folder level script to automate he saveAs function. But why won´t i start at all? Is there an alternative? It do NOT need the save function to be forced without the users input. It would accually be prefered if the user is informed, and asked, if he accepts the saveas action, - but I need the filename to be suggested, so he/she only need to press yes/no or accept/cancel, or something...
As I´ve understood the problems lies in this: ...These methods can be executed only in a privileged context, which includes console, batch and application initialization events. All other events (for example, page open and mouse-up events) are considered non-privileged.
So - how do I run around/solve this problem?
Copy link to clipboard
Copied
Read this:
Copy link to clipboard
Copied
It’s JavaScript not Java!! This is never abbreviated to Java because Java is different.
Info: nothing will work in Android. Savingvisnt even a concept.
Copy link to clipboard
Copied
Here is an article on exactly this topic:
https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript