Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Force Preview to reload a document' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Force Preview to reload a document
Authored by: alblue on Jan 05, '06 02:37:59PM

Firstly, you don't need a script to do this. There's a Revert menu under the File view, and this allows you to reload the document. It's also trivial to bind it to a keystroke, since you can open up System Preferences, go to the Keyboard and Mouse pane, and then in the Keyboard Shortcuts page, click on [+] to add a new shortcut. Simply choose 'Preview' and then type in 'File' and 'Revert' in the boxes (assuming that you're running in English) and a suitable keystroke (I used Command+Shift+R). IIRC you have to restart Preview to get the new binding (after saving the keystrokes by closing System Preferences first!).

Secondly, the reason it's 'Revert' rather than 'Reload' is because you can make changes in Preview. If you do Command+L or Command+R, the PDF document is rotated. Alternatively, you can use the annotate tool (Command+4) to put a 'post-it' style note onto the PDF. Either of these options changes the document, and the close button shows the red zit with the dot in the middle to indicate that the document has changed. You can save it in this new orientation, or with notes on, or in a variety of different formats (e.g. Jpeg/Gif/Png...). In other words, it allows you to revert your changes to the current version on disk (even if that means you haven't had any changes).



[ Reply to This | # ]
Force Preview to reload a document
Authored by: rhowell on Jan 05, '06 03:46:09PM

Brilliant! Thank you for clearly explaining this, step-by-step. This is the solution I've been looking for, as others have I'm sure.

To be clear, in System Preferences->Keyboard & Mouse->Keyboard Shortcuts, the "Menu Title" one adds after clicking the plus (+) button is "Revert" (without the quotes). No "File" should be there.

A quick test to see if your keyboard shortcut has been properly assigned (it took me a while to find one that works), is to then quit System Preferences, quit and reload Preview, and select the File menu. The shortcut will appear next to revert if successful.



[ Reply to This | # ]
Force Preview to reload a document
Authored by: vocaro on Jan 05, '06 08:44:20PM

There's a Revert menu under the File view, and this allows you to reload the document. It's also trivial to bind it to a keystroke

Interesting; I always thought Revert simply reverted changes. I never realized it reloaded the document. However, my script is still useful for two reasons:

  1. Even though you can bind Revert to a keystroke, programmatically reloading a document with a script is useful for LaTeX users like myself who rely on fine-tuned Makefiles for their workflow. For instance, instead of running "make tex" and then typing, say, Command+Shift+R to reload, I can just do "make show" which rebuilds the document and reloads it, saving me a step.
  2. The Revert command resets Preview to the first page of the document, which is very annoying when you're working on, say, page 17 and suddenly you're looking at page 1 and have to jump back. On the other hand, closing and re-opening the document, which is what my script does, keeps Preview on the same page.


[ Reply to This | # ]
Force Preview to reload a document
Authored by: nxg on Jan 09, '06 04:06:58AM

> Simply choose 'Preview' and then type in 'File' and 'Revert'
> in the boxes (assuming that you're running in English) and
> a suitable keystroke (I used Command+Shift+R).

For those of us who are hard-of-thinking, can you be even more explicit?

In that System Preference, there's a single `Menu Title' field. I tried entering "File Revert" (without the quotes), and "'File' 'Revert'", and "File/Revert", but none seem to make any difference, when bound to Control-Command-R. The field has as `explanation' the text `Enter the exact name of the menu command you want to add' which, like AppleScript, gives off an air of being friendly without being in the least bit informative.

Separately, Command-Shift-R appears to be already taken, by the View/Automatically Resize command. Will a System Preference binding of the same keystroke override that?

Thanks for pointers



[ Reply to This | # ]
Force Preview to reload a document
Authored by: peterbacsi on Jul 09, '08 09:28:16AM

My Preview (version 3.0.9) is buggy, since after using Revert,
when I want to navigate to another part of the document using
the drawer, it crashes. The GUI script does not have this problem
as it does not go through Revert.




[ Reply to This | # ]