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

pdf open parameters

New Here ,
Jul 07, 2016 Jul 07, 2016

Is there any way to:

  • implement a startup script that performs operations when a document is opened?
  • pass parameters from code calling the Acrobat Reader to such a script?

I have a document that has a Name field for a person's name. The person's name is known before the document open is attempted. I would like to pass the person's name in as a parameter and have a script inject the name into the Name field upon opening the document.

TOPICS
Acrobat SDK and JavaScript
4.4K
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 ,
Jul 07, 2016 Jul 07, 2016

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.

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 ,
Sep 07, 2016 Sep 07, 2016

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.

My next idea was to implement Javascript in the PDF which would open an XML data file and read the field values from that file. But if I try this solution, the most robust way to know which XML data file to open is to pass the path to the file to the PDF/Javascript via the command line, which you have already said cannot be done.

Now I am perplexed and back where I started. 😞

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 ,
Sep 07, 2016 Sep 07, 2016

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.

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
LEGEND ,
Sep 08, 2016 Sep 08, 2016

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.

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 ,
Sep 12, 2016 Sep 12, 2016
LATEST

The presence of this document changes things a bit:

http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf

In my research of using an XFDF file I was assuming that I would have to:

  1. create an XFDF file containing the person's name as a field value and pointing to the PDF form document
  2. 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:

  1. create an XFDF file containing the person's name as a field value
  2. 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?

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