Solved

refresh pdf on open

Posted on 2004-03-25
9
687 Views
Last Modified: 2012-06-27
I have Adobe Acrobat5, Acrobat Distiller 5.0 and Acrobat Reader 5.1
Is there a way to create a javascript onload event for a pdf. The first time the pdf is opened, it has only the default values populated (which is correct). However once the pdf is filled, edited and submitted successfully, it shows the most recent values instead of default values when I open the pdf the next day. I want to show the default values whenever the pdf is opened for data entry, and not when an editing error occurs.  I have the javascript working correctly to display the error messages when encountering editing errors.
0
Comment
Question by:pbaliga
  • 4
  • 4
9 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10682587
If you have the full version of Acrobat then yes, this can be done, but the free Reader cannot store any data in the PDF file. There are 4KB of global storage that could be used for this, but the updated license agreement for Reader does not allow this anymore (in the past this was 32KB, and was used by some programs to store locally entered data).

If you have a connection of a web server, you can store the data on the server.
0
 

Author Comment

by:pbaliga
ID: 10683069
I do have the full version of acrobat. However my question has to do with refreshing the page every time a new user or for that matter the same user  opens it up the next day. I have listboxes for some fields with default values, which is in the pdf itself.  Is there a javascript pdf onLoad event that I can call to clear the page every time it is opened?  I have a clear button on the page, which calls a javascript (action reset form), but it can be used only after the pdf has been displayed.
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10683187
Sorry, I misunderstood. I promise to read your comments completely next time :-)

Yes, there is a mechanism to reset the values when you open a PDF file, actually, when you open the first page of the document. I don't have access to Acrobat 5 (at least not here, if this does not work, you have to wait until I get to work tomorrow morning). In Acrobat 6 it works this way:

Select the JavaScript menu (I think this is under Tools in A5) and select "Document JavaScripts" and add these lines outside of any JS functions (so that it gets executed when the documen is opened):

var bReset = false;

In order to add this, you have to specify a function name (e.g. test). Once the editor is up, just delete the function it created and add the one line from above.

Then select the first page in the thumbnail view and right-click, select Properties and add a page action to run JavaScript. In the editor add this:

if (!bReset)
{
    this.resetForm();
    bReset = true;
}

This should reset the form the first time the first page of the document is displayed.


0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:pbaliga
ID: 10683300
Thanks for the reply. Will this action also reset the form when the user has made some form validation errors and I have to send it back with an error message. I am calling a javascript for the form validation when the submit button is clicked.( I do not want the values that the user entered to disappear when I show the error message) I will ty it out in the office tomorrow and let you know the result.

Once again thanks for your prompt reply.
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 50 total points
ID: 10683320
Do you open the file again in case of a validation error? If not, then no, the form will not get reset. Because you add the reset script to the PageOpen action for the first page - and only when you open the page for the first time - the reset will not performed if the document is already open.
0
 

Author Comment

by:pbaliga
ID: 10683357
Your explanation makes complete sense. I will let you know tomorrow if this was successful.
0
 

Author Comment

by:pbaliga
ID: 10687498
It worked exactly as you had explained.
Thanks
0
 

Expert Comment

by:Srinivasa_a
ID: 10823771
The above expalnation is very good and very useful.

But I faced error an in Acrobat 5.0.
In thumbnail view of Acrobat 5.0 I selected the first document and right-click, in the popup window Ithere is no Properties option.
How can I add PageOpen action in Acrobat 5.0?

Another doubt is if we make the above changes in Acrobat 6.0/5.0, Is this work in Acrobat 5.0/6.0 reader.

Please help me in this.

Thanks in advance
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10824436
Srinivasa_a, please don't post new questions in already closed questions. If you need help, please open a new question.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the questions I get asked again and again is how to validate a field value in an AcroForm with a custom validation script. Adobe provided a lot of infrastructure to do that with just a simple script. Let’s take a look at how to do that wit…
PaperPort is a popular document imaging/management product from Nuance Communications (http://www.nuance.com/). It is in widespread use by both individuals (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) and businesses (http:/…
In this video, we show how to perform Bates Numbering/Stamping of PDF documents using Power PDF Advanced, the newest product from the Document Imaging division of Nuance Communications. There are two editions of Power PDF — Standard and Advanced. Th…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now