Solved

refresh pdf on open

Posted on 2004-03-25
9
685 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
 

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is in response to a question here (http://www.experts-exchange.com/Other/URLs/Q_28283850.html) at Experts Exchange. The Original Poster has a scanned signature and wants to make the background transparent so that the signature may be pl…
*Adobe Acrobat 9 was used for this article. Particular steps may vary depending on software versions. 1. Create a framework of your form in Word, leaving space where you’d ultimately like the Adobe fields to appear.  (Note: I use the blank lines …
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 video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …

708 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

13 Experts available now in Live!

Get 1:1 Help Now