?
Solved

refresh pdf on open

Posted on 2004-03-25
9
Medium Priority
?
701 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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 200 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Update 21-May-2015: I temporarily removed the source code and the code snippets to make major changes to the program. Regards, Joe A recent question here at Experts Exchange piqued my interest, so I decided to provide a thorough solution and publ…
Update 21-May-2015: I temporarily removed the source code to make major changes to the program. Regards, Joe In a previous Experts Exchange article, How To Rename-Move a Batch of PDF Files Based on Contents of the Files (http://www.experts-exchan…
In this first video of the three-part Xpdf series, we introduce and describe Xpdf, a library containing nine command line utilities that perform various functions on PDF files. We show where the library is located and how to download it, discuss its…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
Suggested Courses
Course of the Month16 days, 2 hours left to enroll

850 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