17

I am editing LaTeX on my Windows Vista systems. Which I am using pdflatex to generate PDF file constantly.

My PDF viewer is Adobe Acrobat Professional 7, I have to close and open the same file each time to get the new look.

Is there any way to keep the PDF viewer refreshing the PDF pages once it changed?

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
Lei
  • 432
  • 2
  • 5
  • 10
  • Similar question on different sites: [texworks - PDF reader on Linux capable of continuous updating - TeX - LaTeX Stack Exchange](https://tex.stackexchange.com/questions/28952/pdf-reader-on-linux-capable-of-continuous-updating) ■ [latex - Windows PDF viewer that auto-refreshes PDF when compiling with pdflatex - Super User](https://superuser.com/questions/337011/windows-pdf-viewer-that-auto-refreshes-pdf-when-compiling-with-pdflatex) – user202729 Feb 25 '23 at 16:10

6 Answers6

18

From a question on super user

SumatraPDF is free, for Windows, and plays nicely with LaTeX. It will automatically refresh when the pdf is updated.

It's also portable, which is nice.

Community
  • 1
  • 1
ForbesLindesay
  • 10,482
  • 3
  • 47
  • 74
15

The viewer does not regularly check changes on disk, so short answer: no (unfortunately)

You could however, use your browser to see the pdf file, inside your own html 'webpage' that regularly refreshes the page using javascript.

this is how (including buttons for switching between manual and automatic refreshing):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
    <title>my pdf</title>

    <script type="text/javascript">
       var timer = null;

       function refresh(){
          var d = document.getElementById("pdf"); // gets pdf-div
          d.innerHTML = '<embed src="myPdfFile.pdf" width="700" height="575">';
       }

       function autoRefresh(){
          timer = setTimeout("autoRefresh()", 2000);
          refresh();
       }

       function manualRefresh(){
          clearTimeout(timer); 
          refresh();   
       }

    </script>

</head>
<body>
   <button onclick="manualRefresh()">manual refresh</button>
   <button onclick="autoRefresh()">auto refresh</button>
   <div id="pdf"></div>
</body> 
<script type="text/javascript">refresh();</script>
</html>

Just save this code as e.g. 'pdfrefresher.html' in the same folder as your pdf. As src of the embed object you use only the filename, e.g. 'myPdfFile.pdf' (not disk or directory). In the code, you can adjust the width and height of the embedded object and the timeout (in milliseconds).

Remi
  • 20,619
  • 8
  • 57
  • 41
  • It's a good solution, however, it keeps refresh the screen. How can I set it only refresh after changing? – Lei Sep 13 '11 at 12:24
  • I'll add a button, moment please – Remi Sep 13 '11 at 12:35
  • Done. I put a button to do manual refresh (which is just somewhat easier than re-opening your document in Adobe viewer). Checking for change is another topic; you can perhaps more easily set the timing interval equal to the interval at which your pdf changes? – Remi Sep 13 '11 at 12:50
  • For the Linux X11 users: You can create a script that executes in vim OnWrite and sends F5 to the PDF Reader. For Mozilla/Firefox you can use this: https://gist.github.com/sijanec/0f5cbc2d894d74f48df80e35838ac967/5347e67495732f07a50bc508661b9642c18a9a63 – jg6 Oct 22 '20 at 16:08
6

Evince pdf viewer auto-refreshes.

It is an extremely light and free (GNU) pdf viewer that is the default on most linux OS. There is a Windows version also. Although, I have used evince only in linux, I am sure it has the same features in Windows.

pudina
  • 69
  • 1
  • 1
3

Adobe Reader and/or Adobe Acrobat are notorious for not supporting auto-refreshing the view of a PDF which changed on disk.

If you need that, you should switch your viewer.

SumatraPDF is available for Windows and does auto-refresh the view. Should it not work at times, you can simply type 'r' to force a refresh...

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
1

For Linux desktop systems, xreader does an excellent job in the "auto-refresh capable" category. Small number of dependencies; not heavily dependent on any particular desktop (ex: GNOME, KDE) either.

starlocke
  • 3,407
  • 2
  • 25
  • 38
1

For user who are on MacOS you have LivePDFViewer that allows you live update of the view and other additional adds like highlighting changes or images zoom.

ek88
  • 51
  • 4