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

New to JavaScript specifically for Adobe Acrobat: Help on Getting started

New Here ,
Nov 01, 2021 Nov 01, 2021

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:

  1. User clicks the button, for now I'm callign it "Finish"
  2. 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.
  3. The file is saved to a file name that will be like this:
    1. \\NetworkPath\YYYYMMDD\FileNameBasedOnAFormField.pdf
    2. YYYYMMDD = Today's date in YearMonthDay format.
  4. 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.

TOPICS
How to , JavaScript , PDF forms
1.2K
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
New Here ,
Nov 01, 2021 Nov 01, 2021

Sorry for the editing, btw, couldn't see how to indend a sublist within another list.

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
New Here ,
Nov 01, 2021 Nov 01, 2021

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.

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 ,
Nov 01, 2021 Nov 01, 2021

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.

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
New Here ,
Nov 01, 2021 Nov 01, 2021

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.

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
New Here ,
Nov 01, 2021 Nov 01, 2021
LATEST

At this point, perhaps this whole idea seems to be wishful thinking.

  1. Cross-compatibility of the JavaScript commands I think would be in question.
  2. 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.

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