5 Replies Latest reply on Nov 20, 2011 1:53 PM by try67

    PDF File - Check for Updated Version via Java???

    hopkinsprinting Level 1

      I want to post some instructional PDF files to my website for my customers to download. From time to time, these PDFs will be updated with new content and I want my customers to always have the latest version.

      I am looking for a Java script that would run when the PDF is opened in Acrobat or Reader that would "phone home" to see if a newer version of itself exists on my site and if so, notify the user and give them the option to download the newer PDF.

      The ideal script would only run every 4th or 5th time the PDF is opened so as not to become annoying to the viewer.

      As I am not a programmer and definitely not familiar with Java, if someone knows how to make this work, a full script would be greatly appreciated.

      Many thanks,
      Jon :-)

        • 1. Re: PDF File - Check for Updated Version via Java???
          Dave Merchant MVP & Adobe Community Professional

          You can't do it with JavaScript as the sandbox prevents two-way network traffic, but it would be possible to do it by coding your "phone home" function into a SWF file and embedding that into the PDF, as rich media annotations are allowed to connect to the Internet - however it will only work in Acrobat/Reader 9+ and users will always be able to block network access, so it can only be an advisory thing rather than an enforceable "document expiry" function.

          • 2. Re: PDF File - Check for Updated Version via Java???
            hopkinsprinting Level 1

            Hi Dave,


            First, many thanks for the reply.  I actually feel like I am getting somewhere with this now!


            As far as the SWF thing and embedding it into the a PDF, would you know how to do that (as well as the code needed)?  It's times like this I wish I were a programmer.


            Thanks again!


            • 3. Re: PDF File - Check for Updated Version via Java???
              Dave Merchant MVP & Adobe Community Professional

              Embedding a SWF is easy in Acrobat Pro, you just add it as an annotation. Writing the ActionScript to check a webserver for update information is also not that hard, but it's a question for the Flash or Flex forums as you'd need to use those programs to create it.


              Simplest option is for the SWF to handle displaying the message (say for example the SWF normally displays nothing but a white rectangle, and it's place on the PDF as a "banner" - if it finds a new version on the website it could display a warning message without caring about the PDF or being embedded in something).

              If you want the SWF to send a message to the PDF itself (say to control layers, disable forms, etc.) then your ActionScript would need to send commands to JavaScript. Again it's not too hard but generic examples are tricky as every case will be different.


              Watch my on-demand seminar at Acrobatusers.com for more information on the AS-JS bridge and how Flash or 3D annotations can talk to the PDF host. It refers to Acrobat 9 but the code is the same in X.

              • 4. Re: PDF File - Check for Updated Version via Java???
                George_Johnson MVP & Adobe Community Professional

                In my opinion this would be far easier to implement with a standard submit form type of action, which can be done using JavaScript. It would have to submit to a script on a web server, which could check for an updated version and return a response, which could alert the user that a new version is available and provide a means to download it. It cannot happen silently, however, since the user would need to allow the submit to take place.


                This approach requires some server-side programming that is beyond the scope of this forum and it would take some expertise. The point is it can't be done with a simple JavaScript inside the PDF. It requires some process on a server to look at the version of the document the user is using and compare it to the most recent version on the server, and generate the approapriate response.

                • 5. Re: PDF File - Check for Updated Version via Java???
                  try67 MVP & Adobe Community Professional

                  I'm developing some JavaScript code (completely embedded in the PDF) that should allow you to do this, without the need for any complex server-side code.

                  I'm looking for someone who is willing to help me test it out. If you're interested, contact me personally by PM or at try6767 at gmail dot com.