wxPrintPreview - Functions for wxPrintPreview class
Please see following description for synopsis
wxPrintPreview(3) Erlang Module Definition wxPrintPreview(3)
NAME
wxPrintPreview - Functions for wxPrintPreview class
DESCRIPTION
Objects of this class manage the print preview process. The object is
passed a wxPrintout object, and the wxPrintPreview object itself is
passed to a wxPreviewFrame object. Previewing is started by initializ-
ing and showing the preview frame. Unlike wxPrinter:print/4, flow of
control returns to the application immediately after the frame is
shown.
Note: The preview shown is only exact on Windows. On other platforms,
the wxDC used for preview is different from what is used for printing
and the results may be significantly different, depending on how is the
output created. In particular, printing code relying on wxDC:getTextEx-
tent/3 heavily (for example, wxHtmlEasyPrinting and other wxHTML
classes do) is affected. It is recommended to use native preview func-
tionality on platforms that offer it (macOS, GTK+).
See: Overview printing, wxPrinterDC (not implemented in wx), wxPrintDi-
alog, wxPrintout, wxPrinter, wxPreviewCanvas, wxPreviewControlBar,
wxPreviewFrame
wxWidgets docs: wxPrintPreview
DATA TYPES
wxPrintPreview() = wx:wx_object()
EXPORTS
new(Printout) -> wxPrintPreview()
Types:
Printout = wxPrintout:wxPrintout()
new(Printout, Options :: [Option]) -> wxPrintPreview()
Types:
Printout = wxPrintout:wxPrintout()
Option =
{printoutForPrinting, wxPrintout:wxPrintout()} |
{data, wxPrintDialogData:wxPrintDialogData()}
Constructor.
Pass a printout object, an optional printout object to be used
for actual printing, and the address of an optional block of
printer data, which will be copied to the print preview object's
print data.
If printoutForPrinting is non-NULL, a "Print..." button will be
placed on the preview frame so that the user can print directly
from the preview interface.
Remark: Do not explicitly delete the printout objects once this
constructor has been called, since they will be deleted in the
wxPrintPreview destructor. The same does not apply to the data
argument.
Use isOk/1 to check whether the wxPrintPreview object was cre-
ated correctly.
new(Printout, PrintoutForPrinting, Data) -> wxPrintPreview()
Types:
Printout = PrintoutForPrinting = wxPrintout:wxPrintout()
Data = wxPrintData:wxPrintData()
destroy(This :: wxPrintPreview()) -> ok
Destructor.
Deletes both print preview objects, so do not destroy these
objects in your application.
getCanvas(This) -> wxPreviewCanvas:wxPreviewCanvas()
Types:
This = wxPrintPreview()
Gets the preview window used for displaying the print preview
image.
getCurrentPage(This) -> integer()
Types:
This = wxPrintPreview()
Gets the page currently being previewed.
getFrame(This) -> wxFrame:wxFrame()
Types:
This = wxPrintPreview()
Gets the frame used for displaying the print preview canvas and
control bar.
getMaxPage(This) -> integer()
Types:
This = wxPrintPreview()
Returns the maximum page number.
getMinPage(This) -> integer()
Types:
This = wxPrintPreview()
Returns the minimum page number.
getPrintout(This) -> wxPrintout:wxPrintout()
Types:
This = wxPrintPreview()
Gets the preview printout object associated with the wxPrintPre-
view object.
getPrintoutForPrinting(This) -> wxPrintout:wxPrintout()
Types:
This = wxPrintPreview()
Gets the printout object to be used for printing from within the
preview interface, or NULL if none exists.
isOk(This) -> boolean()
Types:
This = wxPrintPreview()
Returns true if the wxPrintPreview is valid, false otherwise.
It could return false if there was a problem initializing the
printer device context (current printer not set, for example).
paintPage(This, Canvas, Dc) -> boolean()
Types:
This = wxPrintPreview()
Canvas = wxPreviewCanvas:wxPreviewCanvas()
Dc = wxDC:wxDC()
This refreshes the preview window with the preview image.
It must be called from the preview window's OnPaint member.
The implementation simply blits the preview bitmap onto the can-
vas, creating a new preview bitmap if none exists.
print(This, Prompt) -> boolean()
Types:
This = wxPrintPreview()
Prompt = boolean()
Invokes the print process using the second wxPrintout object
supplied in the wxPrintPreview constructor.
Will normally be called by the Print... panel item on the pre-
view frame's control bar.
Returns false in case of error - call wxPrinter:getLastError/0
to get detailed information about the kind of the error.
renderPage(This, PageNum) -> boolean()
Types:
This = wxPrintPreview()
PageNum = integer()
Renders a page into a wxMemoryDC.
Used internally by wxPrintPreview.
setCanvas(This, Window) -> ok
Types:
This = wxPrintPreview()
Window = wxPreviewCanvas:wxPreviewCanvas()
Sets the window to be used for displaying the print preview
image.
setCurrentPage(This, PageNum) -> boolean()
Types:
This = wxPrintPreview()
PageNum = integer()
Sets the current page to be previewed.
setFrame(This, Frame) -> ok
Types:
This = wxPrintPreview()
Frame = wxFrame:wxFrame()
Sets the frame to be used for displaying the print preview can-
vas and control bar.
setPrintout(This, Printout) -> ok
Types:
This = wxPrintPreview()
Printout = wxPrintout:wxPrintout()
Associates a printout object with the wxPrintPreview object.
setZoom(This, Percent) -> ok
Types:
This = wxPrintPreview()
Percent = integer()
Sets the percentage preview zoom, and refreshes the preview can-
vas accordingly.
wxWidgets team. wx 2.1.1 wxPrintPreview(3)