These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Dynamic Stamp - Multi Field Input

ccs717
Registered: Aug 18 2006
Posts: 20
Answered

One of my favorite article's on this site is Thom's Dynamic Stamp Secrets. I have created several such stamps for my company. Each one to this point has a single field for user input. Now I am being asked to create a stamp with two fields for user input.

I can make it work by having two separate dialog boxes pop up, each with one user input field. How can I get both input fields in one dialog?

Even better would be if one of the user input fields was actually a set of radio buttons. Is that possible? If so how?

I am using Acrobat 8 for the programming.

BTW, I recently signed up for Thom's PDFScripting.com site and highly recommend it. (I have no affiliation with Thom nor am paid by him. Just want to steer business his way as thanks for all the support he provides for free.)

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Have you looked at [url=http://www.acrobatusers.com/tutorials/2007/dynamic_stamp_secrets/]Dynamic stamp secrets[/url] by Thom Parker? The example is for one response request, but one could create multiple request or use the dialog object to gather more data, but this would require more some advanced JS ability.

George Kaiser

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Thanks for reading the article. I'm glad it was useful. That was a fun one to write. And thanks for signing up at pdfscripting.com.

As gKaiseril points out, the input dialog used in "Dynamic Stamp Secrets" is a standard response box. There's not much you can do with this input device. It's just a simple one input function. If you want a more sophisticated user interface you need to go with a custom dialog. I've written an article about creating these as well:

http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/popup_windows_part5/

Custom dialogs can have multiple text inputs, check boxes, radion buttons, custom images, drop down menus, etc. in just about any configuration you want. But of course, they are a whole order of magnitude more difficult to work with than the response box. Although a simple one isn't too bad. You aught to be able to modify the code in the examples for two text input fields and even the radio buttons.

I've written lots of custom dialogs and right away I got sick of the tedium of manually trying to get the layout right. Custom dialogs are all about layout. So I wrote an Acrobat plug-in to do it for me, [url=http://www.windjack.com/products/acrodialogs.php]AcroDialogs[/url]. You can down load a trial copy to check it out. It's basically a JavaScript code generator, and the code it generates will help you to get a better idea of how to make and use the dialogs.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

ccs717
Registered: Aug 18 2006
Posts: 20
Thanks Thom!

Looks like I have some reading to do this weekend.
Addi
Registered: Feb 17 2009
Posts: 1
http://www.acrobatusers.com/tutorials/2007/02/custom_dynamic_stamp

I followed the tutorial above to add date and hour information to our company stamp. Is it possible to do that in Adobe Acrobat 7 Standard? I don't get the selecting capability when I tried it.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
What do you mean by the "selecting capability"? The stamp described in the article uses standard dynamic stamp functionality. It should work all the way back to Acrobat 5.

I believe that Acrobat Standard has a stamps menu? Try out one of the dynamic stamps here. The functionality from the article is no different.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Aprilfawne
Registered: Dec 17 2008
Posts: 5
Hi. I've read your 'dynamic stamp secrets' article and found it very helpful! I've created multiple dynamic 'project submittal' stamps for my company, with fields that the user is prompted to fill in.

I was wondering if it's possible to allow the user to be able to check or uncheck a radio button on a dynamic stamp as well?

Any help is a appreciated. Thanks!

April
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, In fact I've done this with check boxes. Place a check box or radio button on the stamp PDF and then use the user input to turn it on or off. When the stamp is placed the button is flattened out, so it's no longer an input device, but the apperarce of a selected or unselected radio button is left behind.

In the example I used a simple response box for input. But you could use a custom dialog box, which would give you the ability to put check boxes, radio buttons, and lists on the popup dialog. In the Acrobat JavaScript Reference look up "app.execDialog" and the Dialog object.

Also look at [url=http://www.windjack.com/products/acrodialogs.php]AcroDialogs[/url]

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Aprilfawne
Registered: Dec 17 2008
Posts: 5
Great, thanks!
I hate to be a pain, but I may need you to dumb it down for me:) Do i place the check box on the stamp before I "create custom stamp" or do I open the custom stamp from my C:\Documents and Settings\Application Data\Adobe... and add it to that?
Do you by chance have an example of a dynamic stamp with check boxes? Or one showing what you mean about using the custom dialog box to create the check boxes?
Thanks so much for your help!
April
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Open up the existing stamp file. in "C:\Documents and Settings\Application Data\Adobe... " and add the check box there.

To set value of the check box you need to collect input from the user. Start of with something simple, like a yes/no alert box. Just to make sure the stamp works.

If everything is working, then move onto trying out a custom dialog. I have lots of examples. Here's an article:

http://www.acrobatusers.com/tutorials/2006/popup_windows_part5

And here's a tool for creating custom JavaScript dialogs for Acrobat/PDF
http://www.windjack.com/products/acrodialogs.php

Be warned, creating dialogs in Acrobat is an advanced topic.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Aprilfawne
Registered: Dec 17 2008
Posts: 5
Thanks!

Here is where I'm getting stuck. I opened the pdf, made 5 check boxes, and then checked them all. I told the buttons to run a specific JavaScript, opening a window for each. I got the window to open in the pdf, but they buttons are flattened when I use it as a stamp (not editable). What am I doing wrong? I know you mentioned using user input to select or unselect the boxes, but I'm not understanding that.

Also, once the window opens in the PDF, with multiple check box options (such as the last button in your example "Dialog Uses" that asks the user "Route Form To:"), and the user selects boxes, what is the next step? Where does the information from those checked buttons show up?

In the end, I'd like a stamp with 5 checkboxes that can be turned on or off of the dynamic stamp when the user adds the submittal stamp to a file.

Thanks for your help!
April
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
To start out, everything on the stamp is flattened out when it is placed on a PDF. Stamps are static images. The idea of a dynamic stamp, is that data on the stamp is fixed up before it is placed. The form field elements on a stamp can never be directly edited by the user. They have to be set by some other means before the stamp is placed. This is the purpose of the popup response box in Dynamic Stamp Secrets. If you want the data entered on the stamp to be availible as data on the document, then it has to be attached to the document in some way before the stamp is placed. In the Article this is done by placing stamp data in the document metadata.

Hope this explains Stamps a little better.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Aprilfawne
Registered: Dec 17 2008
Posts: 5
Thanks...that does help me understand stamps a bit better.

My main question is, once I have the user prompted by a JavaScript Window, such as your last button in the DialogUses.PDF (the button next to "Control Document Processing"), how do I have that information interact with the stamp? For example, if I clicked "Marketing" in your example, where does that information go? Can I have it appear on my stamp?

Thanks!

April
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The values in a custom dialog are part of the runtime structure of the custom dialog. If you look in the Acrobat JavaScript reference at the "app.execDialog()" function and the "Dialog" object. You'll see that there is a "Commit" function in the "Dialog" object that is automatically called when the user presses the "Ok" button. You have to use this function to copy the dialog field values into something more concrete, like member variables of the Dialog Literal.

If you use [url=http://www.windjack.com/products/acrodialogs.php]AcroDialogs[/url] to build the dialog, you can enter variable names for each dialog element. AcroDialogs will automatically create these variables and fill them in when the user presses the "Ok" button. This is much easier, and more reliable, than writing the code yourself.

When AcroDialogs generates the dialog JavaScript it also creates a usage example at the bottom of the generated code. This usage example shows how to setup initial values before dialog is displayed and how to extract the entered data after the user presses "OK".

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Aprilfawne
Registered: Dec 17 2008
Posts: 5
Thanks!

All of this is definitely well above my knowledge of javascript, so I've downloaded the trial version of AcroDialogs. Will I be able to save out anything I do with the trial version, or will I need to purchase the program in order to do so?

Thanks,
April
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The trial will allow you to make as many dialogs as you want without restriction for the duration.
Write us at support if you have any questions.

Good Luck,
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script