ABU 18-aug-2024 - pdfviewer-0.9.2 (added compatibility with Tcl9)
pdfviewer is a widget for reading and adding annotations to PDF documents. pdfviewer is bundled with all necessary sub-packages, except tclMuPDF, which must be downloaded and installed separately.
pdfviewer is equipped with a built-in menu for navigating between pages, and allows you to annotate (highlight, underline...) parts of the text.
The annotations are recorded in the PDF itself, and therefore the documents are interoperable with other tools such as e.g. Adobe Acrobat Reader.
A peculiarity of pdfviewer is that it is possible to open multiple views on the same document, keeping the changes underway on the pages (annotations) synchronized.
--> See the example "demo/demo01.tcl"
From a programming point of view, there are essentially just 3 operations:
pdfviewer .v1 /tmp/abc.pdf ;# if no page-number is specified, it starts from page 0 pack .v1 -expand 1 -fill both
.v1 saveOnDestroy true ;# changes will be saved without any prompting
or
.v1 saveOnDestroy false ;# upon closing, the changes will NOT be saved
destroy .v1
NOTE: if there are multiple views open on the same document, changes are saved only when the last view is closed).
...
Furthermore, since pdfviewer is an extension of MuPdfWidget, (almost) all the commands of the latter can be used, ... but usually, they are not necessary ...
Example:
.v1 configure -zoomratio 1.1 ;# change the zoom factor (110%)
Here is a screenshot of the included demo: two views on the same document.