12 Replies Latest reply on May 13, 2010 5:13 PM by zsd2

    How to reload a document

      Using acroread 8.1.2 on linux x86_64

      Is there a way to get acroread to reload a pdf that has changed on disc? The only way I can find to do that is to close the document and then reopen it.

      I frequently generate/edit pdf documents via LaTeX and would like to use acroread to preview results; but without a "refresh" option, previewing changes is excessively cumbersome.

      Most other pdf readers (e.g. xpdf) have a "Refresh" option, often mapped to a keystroke. Some may even be set up to reload a document automatically if it changes on disc.

      Lack of this functionality is a show-stopper for me.

        • 1. Re: How to reload a document
          Level 1

          We've received similar feature requests from some other users as well. Currently this isn't supported in the Adobe Reader. However, we've recorded this request with us and would take a note of it during planning for the next release.

          • 2. Re: How to reload a document
            Level 1
            Thanks, Viraj.

            I look forward to it.

            • 3. Re: How to reload a document
              I just wasted a bunch of time because I thought there must be some way to do this. Please add the feature. Thanks,
              • 4. Re: How to reload a document
                In old versions of Adobe Reader, this was possible: Close the file by pressing Ctrl-W and reopen it by either "Ctrl+Cursor left" or "Alt+Cursor left" (changed sometimes in history). This reopened the file at the same position with the same view (magnification etc.).

                Unfortunately, this does not work in Adobe Reader 8 anymore. I have to reopen the file by pressing "Alt+F 1". This way, Adobe Reader forgets about all view settings, and I have to move to the last opened page again. This even occurs when the setting "reopen at old position" (or similar, forgot the name) is switched on.

                Reinvoking the old function to reopen a file with "Ctrl+Curser left" would be very helpful already.
                • 5. Re: How to reload a document
                  Here is a slick method to do it through Javascript on Linux. Create a new text file called (for instance) reload.js and put it into the directory:


                  In the text file write these lines:

                  reloadCurrentDoc = app.trustedFunction(
                  function(currentDoc) {

                  cName: "reloadCurDoc",
                  cUser: "Reload",
                  cParent: "File",
                  cExec: "reloadCurrentDoc(event.target);",
                  cEnable: "event.rc = (event.target != null);",
                  nPos: 0

                  cName: "reloadCurDoc",
                  cExec: "reloadCurrentDoc(event.target);",
                  cToolText: "Reload the current document",
                  cEnable: "event.rc = (event.target != null);",
                  cLabel: "Reload",
                  nPos: -1

                  Close and open Acrobat. A toolbox item called 'Reload' appears and a corresponding menu item in the 'File' menu is added.

                  NOTE: On Ubuntu, remember to install the acrobat-plugins package from the medibuntu repository.

                  Credit to Alexander Grahn for the idea
                  • 6. Re: How to reload a document

                    Another way to do it is to use incron (that uses inotify).

                    First you need a script that reloads acroreader, e.g.~/bin/acro-reload.sh (don't forget to make it executable with chmod a+x ~/bin/acro-reload.sh):


                    # close document if already open
                    ACRO_PID=`ps x | grep acroread | grep $1 | sed -n 's|\([0..9]*\) .*|\1|p'`

                    if [[ -n $ACRO_PID ]]
                    kill $ACRO_PID

                    sleep 0.2

                    # reload document
                    /usr/bin/acroread --display=:0.0 $1 &

                    exit 0

                    Then you need to install incron

                    sudo apt-get install incron

                    and allow your user to use it by adding you user name to /etc/incron.allow

                    sodo vim /etc/incron.allow

                    Now we need to tell incron to start our script whenever a certain PDF (or path) changes by:

                    crontab -e

                    add the following line:

                    /path/that/contains/pdf IN_CLOSE_WRITE,IN_NO_LOOP /home/user/bin/acro-reload.sh $@/$#

                    The first path is the path that is being monitored. The second path is the reference to the script that is being called upon file changes in the first path. $@ and $# are placeholders for the path and file that just changed. They are passed to the script

                    The script first looks for an already open instance of acroread. If it finds one it closes it, sleeps 200 msec, and then reopens acroread.

                    If you encounter an error in the /var/log/Xorg.0.log similar to this

                    AUDIT: Mon Mar 15 10:48:56 2010: 5565 X: client 43 rejected from local host (uid 1000)

                    you need to execute the following

                    xhost local:root


                    I hope that helps.


                    • 7. Re: How to reload a document
                      Vaibhav Padlikar Level 2

                      Document "Reload" feature is included in all versions of Linux Reader 9.x from 9.1 onwards. Do File ->Reload or Ctrl+R to reload a document..





                      • 8. Re: How to reload a document
                        KaiStapel Level 1

                        Good to hear that it finally got included.


                        Still, the solution I posted facilitates an automatic reload of the document when it changes, e.g. when you recompile your Latex document.




                        • 9. Re: How to reload a document
                          James Quirk Level 1



                          Your reload approach could be implemented in Perl using:


                          #! /usr/bin/env perl
                          my @ACROREAD = ('acroread',@ARGV);
                          my $wfile  = $ACROREAD[$#ACROREAD];
                          my $wdelay = 1;
                          my $otime  = 0;
                          my $kid;
                          while(1) {
                             my $ntime = (stat($wfile))[9];
                             if($ntime != $otime) {
                                $otime = $ntime;
                                kill 9, $kid if($kid);
                                unless(($kid = fork)) {
                                   exec @ACROREAD;
                             select(undef, undef, undef, $wdelay);


                          and so there's no need for external third-party software, and no need

                          to use a configuration file. Just save the above in a file myacroread

                          and invoke as:


                              myacroread my.pdf


                          assuming, said file is in your path and marked with chmod +x .


                          Note that this is a barebone script with no error checking, and it also assumes

                          the watched file is the last argument. But it could easily be embelished

                          to provide a more robust solution. And for those who don't like Perl,

                          it could easily be translated into Python or Ruby.


                          Now, for the interesting bit. After installing a package such as xdotool, see:




                          once could modify the above to be:


                          #! /usr/bin/env perl
                          my @ACROREAD = ('acroread',@ARGV);
                          my $wfile  = $ACROREAD[$#ACROREAD];
                          my $wdelay = 1;
                          my $otime  = (stat($wfile))[9];
                          unless((my $kid = fork)) {
                             exec @ACROREAD;
                          while(1) {
                             my $ntime = (stat($wfile))[9];
                             if($ntime != $otime) {
                                $otime = $ntime;
                                chomp(my $wid= (qx{xdotool search --title "Adobe Reader"})[0]);
                                system("xdotool windowactivate $wid");
                                system("xdotool key ctrl+r");
                             select(undef, undef, undef, $wdelay);


                          which  uses Linux/AR's native Reload facility in an automated fashion.


                          Neither of the above is presented as the last word in wrapping acroread,

                          but some people might find them useful.



                          • 10. Re: How to reload a document

                            There are a lot of what I consider to be difficult approaches to the problem outlined above.


                            Look on CTAN for 'xpdfopen' and you will find a program called 'pdfopen' which will reload (or load, if the file is not currently being displayed) a PDF file.  Works for AR 5, 7, 9 and the ugly AR8.


                            Call this program automagically from whatever you use to re-(la)tex your document and life will be good.



                            • 11. Re: How to reload a document
                              James Quirk Level 1

                              I'm not sure what you mean by difficult approaches, but it is worth noting that for AR9

                              the latest version of xpdfopen essentially does what my Perl fragment does;

                              it injects keyboard presses into the AR window. But given my postings to

                              the texhax newsgroup, on the matter, this is probably not surprising.


                              Anyhow as I stated upfront, the Perl fragments were not intended as the last word

                              on wrapping AR. They simply serve to show how one can use the likes of

                              xdotool to automate a commonly requested operation. Moreover

                              the approach is easily generalized to other quite different scenarios,

                              for applications other than PDF browsing, and so is worth bearing in mind

                              for when there is no canned package to hand.



                              • 12. Re: How to reload a document
                                zsd2 Level 1

                                There are two things about some of the above approaches that strike be as problematic.


                                First, some require a variety of other packages to be be installed.  (And yes, until TL2010 is out, I guess people would need to make the effort of getting the latest & greatest xpdfopen.)


                                Second, any solution that requires polling is, IMHO, not very good.  Any process that sits there spinning its wheels is wasting CPU time.  Sure, are recent PC has gots lots of power, but the belief that everyone has so much CPU power that it is OK to waste it puts a lot of computers into landfills (or, hopefully, to recycling centers).


                                It's just wrong to poll when it is possible to instead handle an interrupt.