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

Saving Javascript in Acrobat 7.0 Standard

tortoise
Registered: Apr 15 2009
Posts: 6

Hi, I've downloaded the debugger and now have the javascript console. I've written the code for an alert box and it works fine when I test it within the console. However, acrobat does not allow me to save the document (not because I don't have the right to do so, but because it does recognise that any changes have been made to the document). This is my first time using Javascript, am I missing something? Also, If I save this document on a shared network, will my alert box pop-up when other users open the document? THANKS

My Product Information:
Acrobat Standard 7.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Running some code from the console doesn't make it a part of the document. Do you want this code to run when the document is opened? If so, you need to add it using using the addScript function.
About the network: yes, it should work.

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

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Where have you placed the code in the PDF?

Any actions executed as part of the console are not part of the PDF. You need to place you code as a document level script, one of the many field actions, page actions or one of the document actions.

Have you looked at Thom Parkers series of JavaScript tutorials describing were various locations where JavaScript can be located?

Once JavaScript has been added to a PDF you should be able to save the PDF anywhere the JavaScript will work as long as the user's appliction of Acrobat/Reader has JavaScript enabled.

George Kaiser

tortoise
Registered: Apr 15 2009
Posts: 6
Thanks for the help, how do I use 'addscript' function. Where can I find the tutorials on this subject, I had a look but couldn't find the relating to where javascript can be placed?
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
The tutorials and other articles are posted in the [url=http://www.acrobatusers.com/learning_center]Learning Center[/url] section and in the [url=http://www.acrobatusers.com/learning_center/tutorials]Tutorials[/url] subsection. You can then search for [url=http://www.acrobatusers.com/learning_center/tutorials?title=where+is&tid_1=All&form_build_id=form-60604c76d6d3cdc31d541879d7cf94f1&form_id=views_exposed_form]"where is"[/url] and [url=http://www.acrobatusers.com/learning_center/tutorials?title=calculat&tid_1=All&form_build_id=form-6b772b8d8129a53a8533ae0409e1d1f7&form_id=views_exposed_form]"calculat"[/url] in "any" location.

George Kaiser

tortoise
Registered: Apr 15 2009
Posts: 6
Thank you very much.
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi tortoise,

You can find over 70 tutorials on using Acrobat JavaScript here at AUC in the Learning Center ( go to Tutorials and search with "JavaScript" for a ful listing).

A series with titles beginning "Where Is" goes over the different places JavaScript can be used in PDF forms and documents.

An example PDF at the 4XPDF blog is a great one for a beginner at scripting- there is a link to download the file in the blog entry-
http://www.pdfpdfpdfpdf.com/2009/02/how-to-find-scripts-in-a-pdf/

If you will be developing PDF forms on a regular basis it is almost a sure bet you will be using more JavaScript functionality too. The best and most comprehensive resource available is www.pdfscripting.com which has over 10 hours of video tutorials and heaps of example files and copy-n-paste script examples. It's not free but a small investment for what you get.

Hope this helps,

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com
TheRabidAnt
Registered: Apr 29 2009
Posts: 5
Here's an odd one that I came across:

While doing some distributable form-based PDFs in LiveCycle, I came across something that my client REALLY doesn't like:

The inability to save the actual CONTENT of the pdf, versus just the template-form, itself.

I've enabled them to print and submit via email, but they want to be able to save the document locally- changes intact - to each of the receiver's computers, as redundant back-up.

Since I noticed that there's a way to do it in both FormCalc and Javascript, I've opted to try to do it in the latter, due to it's power and functionality; hoping there's a way to keep it inside the realm of the PDF reader's capability.

I was thinking, perhaps of altering the 'Print Button' code (JavaScript) from [b]xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);[/b]
to something else, but when I tried to change the, [b].print(1...[/b], to, [b].save(1...[/b]
, it balked one me.

It's encoded as an Adobe 7(Dynamic) XML form, but the end-format isn't really important, on the whole to the client, I just want to get this form done, as it's already taken me longer than the billable hours.

Perhaps a way to get it to locally 'echo' a copy of the final, completed form, to a savable state, or perhaps a file? Even if it's just an additional step, like it showing the completed form, and the end-user has to seave it from there would be fine.

Can anyone give me a heads-up on this problem?