You can create a "startup" script by creating a document level script. When you do that, Acrobat will add a function stub, named based on your script name. When you remove that function and just add code directly, that code will get executed when the document is opened.
You cannot pass information from the command line to the document. What you can do is create a FDF or XFDF data file and open that instead of the PDF file. This way, you can pass information to fields in the document. Such a FDF/XFDF file would then have a pointer to the actual PDF file. When you open such a file, Acrobat (or the free Reader) would find that reference to the document, load that document and then fill form fields based on the data in your file.
Thank you for your answers.
What we would like to implement is a simple form system for new employees. We already know the employee's name when we open the form, so we wanted to pre-fill the Name field in the form. When I first read your FDF/XFDF proposal I thought I could just create a XFDF file with the employee's name and pointing to the PDF file; then open the XFDF file with Adobe Reader. But that will not work because we need to save the completed PDF file. It appears that when you open a PDF file indirectly from an XFDF file, Adobe Reader will not allow you to save the PDF with the filled-in field values. So I cannot use the FDF/XFDF route.
Now I am perplexed and back where I started. :-(
If you are using a recent version of the free Reader (version XI or later), you should be able to save the filled in form. Only Reader X and older were not able to save a modified form.
There's not in general a command line unless you are starting Reader. Only the first document will open Reader. After that there will be the same EXE with the original command line; a second EXE just sends a message and terminates.
The presence of this document changes things a bit:
In my research of using an XFDF file I was assuming that I would have to:
- create an XFDF file containing the person's name as a field value and pointing to the PDF form document
- open the XFDF file with Reader, which would in turn cause the PDF to be opened and field values supplied
But now it looks like I can reverse the logic:
- create an XFDF file containing the person's name as a field value
- open the PDF with a parameter pointing to the XFDF file which causes the fields to be filled-in
Well, maybe that's not quite true. The manual references above was written before there was support for XFDF files. I wonder if the command line can be used for XFDF files in addition to FDF files?