Skip to content

GUI scripts to display a PDF using wxPython or Tkinter

Jorj X. McKie edited this page Aug 20, 2018 · 8 revisions

PDFdisplay.py (wxPython)

This demonstrates the superior rendering capabilities of MuPDF using wxPython as the display manager.
To access the program, have a look at PDFdisplay.py in the demo folder of the repository.

Changes in PyMuPDF v1.9.2

The program now supports the display of links contained in a page. When activating this option, the next displayed page will mark any link with a blue-lined frame. When clicking such a link, the respective action will be performed. Supported are links within the document (GoTo), links to other documents (GoToR, in this case subprocess.Popen is used to display the requested document with the standard PDF reader), links to web sites (URI) and named destinations.

Using wxPython-Phoenix

When using this newest wxPython version, you can simply use its new pdfviewer class. This class uses PyMuPDF as its default PDF module (falling back to PyPDF2 if PyMuPDF is unavailable). Here is the sample code provided in the online documentation.

New since August 2018: A GUI for Tkinter

This GUI script is based on Tkinter and the pure Python package PySimpleGUI (version > 2.9.0 required). For the time being, get a version from the latest development branch. You only need to copy PySimpleGUI.py to a place where your import statement can find it - no installation needed.

It also requires a Python version 3.x.

The script features Next / Previous / First / Last buttons and - for demonstration purposes - also has some buttons to zoom into quarter pages of the display

doc-browser.py

Clone this wiki locally