New to JavaScript specifically for Adobe Acrobat: Help on Getting started
Copy link to clipboard
Copied
I have never bothered with JavaScript, but suddenly need to build what I think will be a simple button on a PDF form built in Adobe Acrobat at work. So far, I'm somehow not finding the right resources to get started.
Here's the ideas of what I want to do:
- User clicks the button, for now I'm callign it "Finish"
- The file is flattened so cannot be edited later - thought of that from another mention I found online - I'm guessing I can go back to their examples to insert that piece into my final code here.
- The file is saved to a file name that will be like this:
- \\NetworkPath\YYYYMMDD\FileNameBasedOnAFormField.pdf
- YYYYMMDD = Today's date in YearMonthDay format.
- Once the file is saved, close out of the current file or possibly close that file and reopen the origina/template.
Any kind soul here that can give me any tips? Is there a way I can use NotePad++ or Visual Studio Code or some other tool and actually have intellisense available that'll help me sort this out on my own? Or anyone who can guide me on this?
I sould sure think these are very simple operations.
Most of my coding experience to date has been MS SQL Server and MS VBA. Plenty of experience there, but absolutely totally new to JavaScript to make things happen in Acrobat, and have only barely glanced at JavaScript in general to date.
Thanks for any info/advice.
Copy link to clipboard
Copied
Sorry for the editing, btw, couldn't see how to indend a sublist within another list.
Copy link to clipboard
Copied
And it looks like the YouTube post has some age on it, references an Adobe forum post on the flatten code that apparently has since been removed. So I'll need to find that as well.
Copy link to clipboard
Copied
2) Flattening is only possible if they use Acrobat. If they have Reader the closest you can get to it is to set the fields as read-only. Alternatively, you can lock the fields if the user digitally signs the file. That's the most secure version of doing it, too.
3) This is only possible if a script is installed on the local machine of each user, but the folder with the current date as its name will have to already exist. The script can't create it.
Generally speaking you should get the JavaScript for Acrobat API Reference document from within the Acrobat SDK and use it when developing your code, but most of what you asked for has been discussed on these forums, including code examples, so try searching around first.
Copy link to clipboard
Copied
Thanks for the information! I realize these should be trivial items and there should be posts with content.
You bring up a VERY important topic: ability to actually run the code.
At the moment, this will at least mostly be run from a Windows tablet that has an older version of Acrobat Pro installed. HOWEVER, if it runs on other PCs, most of them in that area have a competing PDF editor (Bluebeam Revu).
Is it possible that if I build this JavaScript behind a button that it will only work with Acrobat and not Revu? If so, perhaps I need to rethink the whole idea of automating anything.
Copy link to clipboard
Copied
At this point, perhaps this whole idea seems to be wishful thinking.
- Cross-compatibility of the JavaScript commands I think would be in question.
- Mention of creating a folder if it does not exist. If JavaScript cannot handle this, then it's going to be annoying because I would need another method to handle that function.
Either I think the users will have to manually handle the file save details or else I'll convince them to use one of the MS Office programs and simply print a PDF.

