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

Create popup window on PDF open

slang75
Registered: Apr 22 2009
Posts: 15

Hi All,

I have a simple PDF that I would like to have a popup text window with instructions (for the user to fill out the form) popup once the PDF is opened. Can anyone help me on how to do this?

Thanks!

My Product Information:
Acrobat Standard 7.0, Windows
prander
Registered: Nov 6 2008
Posts: 44
Funny you should ask this. I know how to do this, but I need to take it a step further.
First, your answer (as created in Acrobat 8 Pro):
You would create an "appalert" javascript in the Page Properties box.
Click on "Pages" on the left navigation area.
Highlight/click the first page.
On settings, choose: "Page Properties"
Click the "actions" tab.
For "trigger" choose "Page Open"
For "action:" choose "Run JavaScript" from the drop down
In the script, write something like:

app.alert("INFORMATION \n" + "\ \n" +"\This form contains text fields that allow CSRs to fill out the customer information and then send the form via e-mail for the customer to sign and return to Company A. \n" + "\ \n" + "\After completing the form for the customer, hit the SEND TO CUSTOMER button. An e-mail will open with the form attached and a generic e-mail address. Replace the generic address with the customer's address. Complete the text of the message with instructions on how the customer can return the form including a fax number and your name. \n" + "\ \n" + "\A different version of this form is also available on the web at www.companyname.org/about\n" + "\
" ,3)

the references \n" + "\ designate a new line of text

So, in my case the below "Warning: JavaScript Window - " would read:
INFORMATION

This form contains text fields that allow the CSR...return to the company.

After completing the form for the customer, hit the SEND TO CUSTOMER button...return the form including a fax number and your name.

A different version of this form is also available on the web at www.companyname.org/bout


My follow-up question:
On my form with that app.alert, I also have a submit button which is more of an 'e-mail to the customer' button which creates a partial complete form attached to an e-mail that is sent to the customer to complete. Is there a way to delete the app.alert/warning when that attachment is created? I don't want the customer to see the message that the CSRs receive. Even better would be a NEW message in place of the CSR message, telling customers how to complete the form.

Hope this helps,
slang75
try67
Expert
Registered: Oct 30 2008
Posts: 2398
prander's advice will create a pop-up each time you access the first page, which is not the same as a pop-up when the file is opened. To achieve that you indeed use the app.alert method, but place it as a document-level script (via Advanced - Document Processing - Document JavaScripts) so that it will only launch when the file is opened.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

slang75
Registered: Apr 22 2009
Posts: 15
Thanks both of you! Try67 can you please elaborate? I am new to javascript code and I don't even know where to begin.

Thanks,

slang75
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Basically you just enter this script to the place I described (make sure you delete the stuff that's already in there when you create a new script):

app.alert("Some text here",3);

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

slang75
Registered: Apr 22 2009
Posts: 15
I got it, for anyone else who does a search, I will tell you how to do it.

Open the specific PDF-file in Adobe Acrobat Pro. In the menubar go to 'Advanced' > 'Document Processing' > 'Document JavaScipts'.
Now a window as shown above appears. Give your script a name, (message) click 'Add', fill in the script with your message, type this

var msg = "Type your message here"
app.alert(msg);

written between the quotation marks and make sure that 'app.alert(msg);' starts on a new line. Now close the windows and save the PDF.


slang75
try67
Expert
Registered: Oct 30 2008
Posts: 2398
If you do it like that the message will be displayed as an error message. If you want it to be an Information message, change the second line to:
app.alert(msg,3);

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

prander
Registered: Nov 6 2008
Posts: 44
Thanks for clarifying that for him try67. Is there a solution to my issue which is to write script to delete the initial script after a 'saved' pdf is created for a submission?

Thanks
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Sorry, I'm not sure what you mean, exactly.
Generally speaking, if you want to remove a document-level script, just overwrite using this.addScript().

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

TonyPotter
Registered: Feb 1 2010
Posts: 85
I have tried the way try17 suggested, it works well. Erh, a nice solution

I will try my best to help you in PDF converison fields, objectively and Neutral.