?
Solved

refresh pdf on open

Posted on 2004-03-25
9
Medium Priority
?
695 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Getting information about Fonts being used in a PDF file A colleague of mine recently faced an issue related to the PDF file format. The PDFs were containing mission critical client information, they were successfully mailed but there was a sm…
*Adobe Acrobat 9 was used for this article.  Particular steps may vary depending on software versions. Adobe Acrobat has many, many variables that my be utilized to customize your forms for clarity and ease of use. The Form Editing Tool will be y…
In this third video of the Xpdf series, we discuss and demonstrate the PDFtoText utility, which converts PDF files into plain text files. Download and install the software.: You may have already downloaded and installed the Xpdf tools while watching…
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…

771 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