[pdftex] ``Reload'' function for Adobe Reader (Linux)

Alexander Grahn A.Grahn at fzd.de
Thu Jan 22 13:56:56 CET 2009


Hi,

I wrote a little JavaScript that adds a ``Reload'' item to the
``File'' menu of Adobe Reader. It allows to reload the PDF document
currently viewed in the Reader to reflect the latest changes. The last
view (page number and zoom state) will be restored.

Since Windows does not allow to overwrite a document currently open in
another application, this script makes sense under Linux (or other Unix-
alikes) only.

You will have to put the script to ~/.adobe/Acrobat/8.0/JavaScripts.
Then close and restart Adobe Reader.

Although I have already posted this message to ctt, I dare write it here
again (to help spread the word :-)).

Hope you will find it useful. No warranty.
Alexander 

////////////////////////////////////////////////////////////////////////////
//
// *** reloadCurDoc.js ***
//
// * folder level JavaScript, to be put to:
//
//   $HOME/.adobe/Acrobat/8.0/JavaScripts
//   (version number might need to be adjusted)
//
// * adds item ``Reload'' to the ``File'' menu of Adobe Reader
// * reloads the current document and restores page number and zoom state 
//
// © Alexander Grahn, 2009
//
///////////////////////////////////////////////////////////////////////////

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
});


More information about the pdftex mailing list