Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Current Adobe Reader 9.4.2 allows you to press Ctrl+R to reload an opened PDF. However, there seems to be no way to add that functionality to the toolbar.

Do you know of any custom scripts that would allow me to add such a reload button?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I found the following JavaScript code via Google:

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

I then saved this under ~/.adobe/Acrobat/9.0/JavaScripts/reloadButton.js and now I get an additional toolbar containing a "Reload" button that does exactly what I need.

Things to improve:

  • The toolbar pops up with a delay, not sure that can be fixed.
  • You can reload without an open document -> NPE.
  • The button is always added in a separate toolbar, I'd love to add it just to the other ones.
  • The code also seems to add a menu item, I haven't yet checked if I can simply remove that part.

If you got any suggestions on how to improve this answer, please leave a comment.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.