This class encapsulates the functionality of printing out an application document.
A new class must be derived and members overridden to respond to calls such as
Your derived
See:
wxWidgets docs:
Constructor.
Creates a
Notice: The callbacks may not call other processes.
Destructor.
Returns the device context associated with the printout (given to the printout at start of printing or previewing).
The application can use
This will be a
Returns the size of the printer page in millimetres.
Returns the size of the printer page in pixels, called the page rectangle.
The page rectangle has a top left corner at (0,0) and a bottom right corner at (w,h). These values may not be the same as the values returned from
Returns the rectangle that corresponds to the entire paper in pixels, called the paper rectangle.
This distinction between paper rectangle and page rectangle reflects the fact that most printers cannot print all the way to the edge of the paper. The page rectangle is a rectangle whose top left corner is at (0,0) and whose width and height are given by wxDC::GetPageSizePixels().
On MSW and Mac, the page rectangle gives the printable area of the paper, while the paper rectangle represents the entire paper, including non-printable borders. Thus, the rectangle returned by wxDC::GetPaperRectPixels() will have a top left corner whose coordinates are small negative numbers and the bottom right corner will have values somewhat larger than the width and height given by wxDC::GetPageSizePixels().
On other platforms and for PostScript printing, the paper is treated as if its entire area were printable, so this function will return the same rectangle as the page rectangle.
Returns the number of pixels per logical inch of the printer device context.
Dividing the printer PPI by the screen PPI can give a suitable scaling factor for drawing text onto the printer.
Remember to multiply this by a scaling factor to take the preview DC size into account. Or you can just use the FitThisSizeToXXX() and MapScreenSizeToXXX routines below, which do most of the scaling calculations for you.
Returns the number of pixels per logical inch of the screen device context.
Dividing the printer PPI by the screen PPI can give a suitable scaling factor for drawing text onto the printer.
If you are doing your own scaling, remember to multiply this by a scaling factor to take the preview DC size into account.
Returns the title of the printout.
Returns true if the printout is currently being used for previewing.
See:
Set the user scale and device origin of the
Use this if you're managing your own page margins.
Note: With most printers, the region around the edges of the paper are not printable so that the edges of the image could be cut off.
Set the user scale and device origin of the
On MSW and Mac, the page rectangle is the printable area of the page. On other platforms and PostScript printing, the page rectangle is the entire paper.
Use this if you want your printed image as large as possible, but with the caveat that on some platforms, portions of the image might be cut off at the edges.
Set the user scale and device origin of the
This function provides the greatest consistency across all platforms because it does not depend on having access to the printable area of the paper.
Remark: On Mac, the native
Set the user scale and device origin of the
That is, a 100-pixel object on screen should appear at the same size on the printed page. (It will, of course, be larger or smaller in the preview image, depending on the zoom factor.)
Use this if you want WYSIWYG behaviour, e.g., in a text editor.
This sets the user scale of the
This sets the user scale of the
Set the user scale and device origin of the
That is, the user scale is set to (1,1) and the device origin is set to (0,0).
Use this if you want to do your own scaling prior to calling
You can use the GetLogicalXXXRect() routines below to obtain the paper rectangle, page rectangle, or page margins rectangle to perform your own scaling.
Note: While the underlying drawing model of macOS is floating-point, wxWidgets's drawing model scales from integer coordinates.
Return the rectangle corresponding to the paper in the associated
Return the rectangle corresponding to the page in the associated
On MSW and Mac, this will be the printable area of the paper. On other platforms and PostScript printing, this will be the full paper rectangle.
Return the rectangle corresponding to the page margins specified by the given
The page margins are specified with respect to the edges of the paper on all platforms.
Set the device origin of the associated
Shift the device origin by an amount specified in logical coordinates.