Skip to main content
Participant
March 14, 2008
Question

How to reload a document

  • March 14, 2008
  • 6 replies
  • 47934 views
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.

Regards,
Lionel

6 replies

March 15, 2010

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):

#!/bin/bash

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

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

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.

Best,
Kai

March 17, 2010

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

-vaibhav

March 17, 2010

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.

Best,

Kai

Participant
March 13, 2009
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:

~/.adobe/Acrobat/8.0/JavaScripts/

In the text file write these lines:

reloadCurrentDoc = app.trustedFunction(
function(currentDoc) {
app.beginPriv();
currentDocView=currentDoc.viewState;
currentDocPath=currentDoc.path;
currentDoc.closeDoc();
currentDoc=app.openDoc(currentDocPath);
currentDoc.viewState=currentDocView;
app.endPriv();
});

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

app.addToolButton({
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
http://www.tug.org/pipermail/pdftex/2009-January/007934.html
Participant
May 14, 2008
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.
Participant
April 10, 2008
I just wasted a bunch of time because I thought there must be some way to do this. Please add the feature. Thanks,
Fred
Participant
March 14, 2008
Thanks, Viraj.

I look forward to it.

Lionel
Participant
March 14, 2008
Lionel,

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.

Thanks,
-vc