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

John Culleton john at wexfordpress.com
Thu Jan 22 14:41:07 CET 2009


On Thursday 22 January 2009 07:56:56 am Alexander Grahn wrote:
> 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
> });
> _______________________________________________
> pdftex mailing list
> pdftex at tug.org
> http://tug.org/mailman/listinfo/pdftex

Interesting. As you may know kpdf on KDE will do an automatic reload 
when the base document changes. That's why I use it in conjunction 
with Gvim when developing documents or indexes.  I have F keys in 
Gvim reassigned as folllows
F2 Justify GVim text ragged right.
F3 Run the file book.tex through pdftex
F4 Run th efile book.tex trhough Context
F5 Display the file book.pdf in kpdf

F5 need be executed only once per session.  Here is a fragment 
of .gvimrc code. Talk about obscure notation!

inoremap <F3> <C-O>:!pdftex book.tex<Cr>
nnoremap <F3> :!pdftex book.tex<Cr>
inoremap <F4> <C-O>:!texexec book.tex >/dev/null<Cr>
nnoremap <F4> :!texexec book.tex >/dev/null<Cr>
inoremap <F5> <C-O>:!kpdf book.pdf & <Cr>
nnoremap <F5> :!kpdf book.pdf & <Cr>
nnoremap <F2> 1GgqG
inoremap <F2>   1GgqGi


-- 
John Culleton
Resources for every author and publisher:
http://wexfordpress.com/tex/shortlist.pdf
http://wexfordpress.com/tex/packagers.pdf
http://www.creativemindspress.com/newbiefaq.htm
http://www.gropenassoc.com/TopLevelPages/reference%20desk.htm


More information about the pdftex mailing list