Skip to content

GUI scripts to display a PDF using wxPython or Tkinter

Jorj X. McKie edited this page Jun 25, 2020 · 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.

It runs with Python 2 or 3 (you must install PySimpleGUI27 if Python 2).

The script features direct jumping to pages, Next / Previous buttons and - for demonstration purposes - also has some buttons to zoom into quarter pages of the display.

Also note, that not only PDF files can be displayed - support is for all document types (XPS, EPUB, ...).

doc-browser.py

Clone this wiki locally