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)
Default class constructor. |
|
Compute the required buffer sizes to hold the viewed rectangle and |
|
Go to page |
|
Read pdf file. Assume all pages are same size, for now. |
|
Redraw on resize. |
|
Refresh visible window with bitmap contents. |
|
Buffer size change due to client area resize. |
|
Recalculate and redraw visible area. CallAfter is essential |
|
Print the pdf. |
|
Recalculate dimensions as client area may have been scrolled or resized. |
|
Save a copy of the pdf file if it was originally named |
|
Positive integer or floating zoom scale will render the file at corresponding |
Property to control if file reading progress is shown (PyPDF2 only) |
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)
Default class constructor.
parent (wx.Window) – parent window. Must not be None
;
nid (integer) – window identifier. A value of -1 indicates a default value;
pos (tuple or wx.Point
) – the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
size (tuple or wx.Size
) – the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform;
style (integer) – the button style (unused);
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
Go to page
pagenum (integer) – go to the provided page number if it is valid
Read pdf file. Assume all pages are same size, for now.
pdf_file – can be either a string holding
a filename path or a file-like object.
Redraw on resize.
Refresh visible window with bitmap contents.
Buffer size change due to client area resize.
Recalculate and redraw visible area. CallAfter is essential for coordination.
Print the pdf.
prompt (boolean) – 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.
printer_name (string) – the name of the printer that is to receive the printout. Default: as set by the O/S.
orientation – select the orientation (wx.PORTRAIT
or
wx.LANDSCAPE
) for the printout. Default: as set by the O/S.
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.
Save a copy of the pdf file if it was originally named
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
zoomscale – an integer or float
Property to control if file reading progress is shown (PyPDF2 only)