Working with wxPrintout methods

There are a few getter-type methods in wx.Printout that allow you to retrieve information about the current print environment. Table 17.1 lists these information retrieval methods.

Table 17.1 Information retrieval methods of wx.Printout

Method

Description

GetDC()

This method returns the device context to be used for drawing the document for the printer or the print preview.

GetPageInfo()

Returns a 4-element tuple (minPage, maxPage, pageFrom, pageTo). The minPage and maxPage return values are the lowest and highest allowable page numbers, and they default to 1 and 32000. The pageFrom and pageTo values are the range that must be printed, and those values default to 1. You may override this method in your sublclass.

GetPageSizeMM()

Returns a tuple (w, h) of the width and height of a page in millimeters.

GetPageSizePixels()

Returns a tuple (w, h) of the width and height of a page in pixels. If the printout is being used for a print preview, the pixel count will reflect the current zoom level, meaning that the reported pixel count will change with the zoom level.

GetPPIPrinterO

Returns a tuple (w, h) of the pixels per inch of the current printer in both horizontal and vertical directions. In a preview, this value is consistent even if the zoom level of the preview changes.

GetPPIScreen()

Returns a tuple (w, h) of the pixels per inch of the current screen in both horizontal and vertical directions. In a preview, this value is consistent even if the zoom level of the preview changes.

GetTitleO

Returns the printout's title.

In the following sections, we'll discuss how to present the print dialog box to the user.

0 0

Post a comment