4 August 2016 Phoenix updates for wx.lib.pdfviewer and demo/PDFViewer

demo/viewer.py and viewer_basics.py removed - was demo of obsolete vtk
This commit is contained in:
David Hughes
2016-08-04 11:26:08 +01:00
parent 9cb833a2f1
commit 56cad152d9
9 changed files with 544 additions and 819 deletions

View File

@@ -3,7 +3,6 @@
import wx
try:
import pyPdf
from wx.lib.pdfviewer import pdfViewer, pdfButtonPanel
havePyPdf = True
except ImportError:
@@ -51,10 +50,13 @@ def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
else:
from Main import MessagePanel
from wx.lib.msgpanel import MessagePanel
win = MessagePanel(nb,
'This demo requires the pyPdf package to be installed.\n'
'See: http://pybrary.net/pyPdf/',
'This demo requires either the\n'
'PyMuPDF see http://pythonhosted.org/PyMuPDF\n'
'or\n'
'PyPDF2 see http://pythonhosted.org/PyPDF2\n'
'package installed.\n',
'Sorry', wx.ICON_WARNING)
return win
@@ -66,9 +68,22 @@ The wx.lib.pdfviewer.pdfViewer class is derived from wx.ScrolledWindow
and can display and print PDF files. The whole file can be scrolled from
end to end at whatever magnification (zoom-level) is specified.
<p> The viewer uses <b>pyPdf</b> to parse the pdf file so it is a requirement that
this must be installed. The pyPdf home page is http://pybrary.net/pyPdf/
and the library can also be downloaded from http://pypi.python.org/pypi/pyPdf/1.12
<p> The viewer checks for the <b>PyMuPDF</b> then the <b>PyPDF2</b> package.
If neither are installed an import error exception will be raised.
<p>PyMuPDF contains the Python bindings for the underlying MuPDF library, a cross platform,
complete PDF rendering library that is GPL licenced. PyMuPDF version 1.9.2 or later is required.
<p>Further details on PyMuPDF can be found via http://pythonhosted.org/PyMuPDF
<p>PyPDF2 provides a PdfFileReader class that is used to read the content stream of a PDF
file which is subsequently rendered by the viewer itself.
Please note that this is not a complete implementation of the pdf specification and
will probably fail to render any random PDF file you supply. However it does seem to
behave correctly with files that have been produced by ReportLab using Western languages.
The main limitation is that it doesn't currently support embedded fonts.
<p>Additional details on PyPDF2 can be found via http://pythonhosted.org/PyPDF2
<p> There is an optional pdfButtonPanel class, derived from wx.lib.agw.buttonpanel,
that can be placed, for example, at the top of the scrolled viewer window,
@@ -82,12 +97,6 @@ Externally callable methods are: LoadFile, Save, Print, SetZoom, and GoPage.
otherwise wx.GraphicsContext is used. Printing is achieved by writing
directly to a wx.PrintDC and using wx.Printer.
<p> Please note that pdfviewer is a far from complete implementation of the pdf
specification and will probably fail to display any random file you supply.
However it does seem to be OK with the sort of files produced by ReportLab that
use Western languages. The biggest limitation is probably that it doesn't (yet?)
support embedded fonts and will substitute one of the standard fonts instead.
</body></html>
"""