1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.pdfviewer.viewer
.. highlight:: python
.. _wx.lib.pdfviewer.viewer.pdfViewer:
==========================================================================================================================================
|phoenix_title| **wx.lib.pdfviewer.viewer.pdfViewer**
==========================================================================================================================================
View pdf file in a scrolled window. Contents are read from PDF file
and rendered in a GraphicsContext. Show visible window contents
as quickly as possible then, when using pyPDF, read the whole file and build
the set of drawing commands for each page. This can take time for a big file or if
there are complex drawings eg. ReportLab's colour shading inside charts and a
progress bar can be displayed by setting self.ShowLoadProgress = ``True`` (default)
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>pdfViewer</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.pdfviewer.viewer.pdfViewer_inheritance.png" alt="Inheritance diagram of pdfViewer" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="11,5,112,35"/> <area shape="rect" id="node2" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="63,83,173,112"/> <area shape="rect" id="node4" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="58,160,179,189"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="136,5,217,35"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="74,237,163,267"/> <area shape="rect" id="node6" href="wx.ScrolledWindow.html" title="wx.ScrolledWindow" alt="" coords="49,392,188,421"/> <area shape="rect" id="node8" href="wx.lib.pdfviewer.viewer.pdfViewer.html" title="wx.lib.pdfviewer.viewer.pdfViewer" alt="" coords="5,469,232,499"/> </map>
</p>
|
|super_classes| Known Superclasses
==================================
:class:`wx.ScrolledWindow`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.__init__` Default class constructor.
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.CalculateDimensions` Compute the required buffer sizes to hold the viewed rectangle and
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.GoPage` Go to page
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.LoadFile` Read pdf file. Assume all pages are same size, for now.
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.OnIdle` Redraw on resize.
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.OnPaint` Refresh visible window with bitmap contents.
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.OnResize` Buffer size change due to client area resize.
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.OnScroll` Recalculate and redraw visible area. CallAfter is *essential*
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.Print` Print the pdf.
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.Render` Recalculate dimensions as client area may have been scrolled or resized.
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.RenderPageBoundaries` Show non-page areas in grey.
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.Save` Save a copy of the pdf file if it was originally named
:meth:`~wx.lib.pdfviewer.viewer.pdfViewer.SetZoom` Positive integer or floating zoom scale will render the file at corresponding
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.lib.pdfviewer.viewer.pdfViewer.ShowLoadProgress` Property to control if file reading progress is shown (PyPDF2 only)
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: pdfViewer(wx.ScrolledWindow)
View pdf file in a scrolled window. Contents are read from PDF file
and rendered in a GraphicsContext. Show visible window contents
as quickly as possible then, when using pyPDF, read the whole file and build
the set of drawing commands for each page. This can take time for a big file or if
there are complex drawings eg. ReportLab's colour shading inside charts and a
progress bar can be displayed by setting self.ShowLoadProgress = ``True`` (default)
.. method:: __init__(self, parent, nid, pos, size, style)
Default class constructor.
:param wx.Window `parent`: parent window. Must not be ``None``;
:param integer `nid`: window identifier. A value of -1 indicates a default value;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:type `pos`: tuple or :class:`wx.Point`
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform;
:type `size`: tuple or :class:`wx.Size`
:param integer `style`: the button style (unused);
.. method:: CalculateDimensions(self)
Compute the required buffer sizes to hold the viewed rectangle and
the range of pages visible. Set self.page_buffer_valid = ``False`` if
the current set of rendered pages changes
.. method:: GoPage(self, pagenum)
Go to page
:param integer `pagenum`: go to the provided page number if it is valid
.. method:: LoadFile(self, pdf_file)
Read pdf file. Assume all pages are same size, for now.
:param `pdf_file`: can be either a string holding
a filename path or a file-like object.
.. method:: OnIdle(self, event)
Redraw on resize.
.. method:: OnPaint(self, event)
Refresh visible window with bitmap contents.
.. method:: OnResize(self, event)
Buffer size change due to client area resize.
.. method:: OnScroll(self, event)
Recalculate and redraw visible area. CallAfter is *essential*
for coordination.
.. method:: Print(self, prompt=True, printer_name=None, orientation=None)
Print the pdf.
:param boolean `prompt`: show the print dialog to the user (True/False). If
False, the print dialog will not be shown and the pdf will be printed
immediately. Default: True.
:param string `printer_name`: the name of the printer that is to
receive the printout. Default: as set by the O/S.
:param `orientation`: select the orientation (:class:`wx.PORTRAIT` or
:class:`wx.LANDSCAPE`) for the printout. Default: as set by the O/S.
.. method:: Render(self)
Recalculate dimensions as client area may have been scrolled or resized.
The smallest unit of rendering that can be done is the pdf page. So render
the drawing commands for the pages in the visible rectangle into a buffer
big enough to hold this set of pages. Force re-creating the page buffer
only when client view moves outside it.
With PyPDF2, use gc.Translate to render each page wrt the pdf origin,
which is at the bottom left corner of the page.
.. method:: RenderPageBoundaries(self, gc)
Show non-page areas in grey.
.. method:: Save(self)
Save a copy of the pdf file if it was originally named
.. method:: SetZoom(self, zoomscale)
Positive integer or floating zoom scale will render the file at corresponding
size where 1.0 is "actual" point size (1/72").
-1 fits page width and -2 fits page height into client area
Redisplay the current page(s) at the new size
:param `zoomscale`: an integer or float
.. attribute:: ShowLoadProgress
Property to control if file reading progress is shown (PyPDF2 only)
|