wxRuby Documentation Home

# Wx::PrintPreview

Objects of this class manage the print preview process. The object is passed
a Printout object, and the PrintPreview object itself is passed to
a PreviewFrame object. Previewing is started by initializing and showing
the preview frame. Unlike Printer::Print, flow of control returns to the application
immediately after the frame is shown.

## Derived from

Object

## See also

Printing framework overviewprintingoverview, PrinterDC, PrintDialog, Printout, Printer, PreviewCanvas, PreviewControlBar, PreviewFrame.

## Methods

- PrintPreview.new
- PrintPreview#get_canvas
- PrintPreview#get_current_page
- PrintPreview#get_frame
- PrintPreview#get_max_page
- PrintPreview#get_min_page
- PrintPreview#get_printout
- PrintPreview#get_printout_for_printing
- PrintPreview#is_ok
- PrintPreview#paint_page
- PrintPreview#print
- PrintPreview#render_page
- PrintPreview#set_canvas
- PrintPreview#set_current_page
- PrintPreview#set_frame
- PrintPreview#set_printout
- PrintPreview#set_zoom

### PrintPreview.new

PrintPreview.new(%(arg-type)Printout% printout, Printout printoutForPrinting, PrintData data=NULL)

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.

Do not explicitly delete the printout objects once this destructor has been
called, since they will be deleted in the PrintPreview constructor.
The same does not apply to the data argument.

Test the Ok member to check whether the PrintPreview object was created correctly.
Ok could return false if there was a problem initializing the printer device context
(current printer not set, for example).

destructor()

Destructor. Deletes both print preview objects, so do not destroy these objects
in your application.

### PrintPreview#get_canvas

“PreviewCanvas* ":previewcanvas* .html get_canvas()

Gets the preview window used for displaying the print preview image.

### PrintPreview#get_current_page

Integer get_current_page()

Gets the page currently being previewed.

### PrintPreview#get_frame

Frame get_frame()

Gets the frame used for displaying the print preview canvas
and control bar.

### PrintPreview#get_max_page

Integer get_max_page()

Returns the maximum page number.

### PrintPreview#get_min_page

Integer get_min_page()

Returns the minimum page number.

### PrintPreview#get_printout

Printout get_printout()

Gets the preview printout object associated with the PrintPreview object.

### PrintPreview#get_printout_for_printing

Printout get_printout_for_printing()

Gets the printout object to be used for printing from within the preview interface,
or NULL if none exists.

### PrintPreview#is_ok

Boolean is_ok()

Returns true if the PrintPreview is valid, false otherwise. It could return false if there was a
problem initializing the printer device context (current printer not set, for example).

### PrintPreview#paint_page

Boolean paint_page(%(arg-type)PreviewCanvas% canvas, DC dc)

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 canvas, creating a new preview bitmap if none exists.

### PrintPreview#print

Boolean print(%(arg-type)Boolean% prompt)

Invokes the print process using the second Printout object
supplied in the PrintPreview constructor.
Will normally be called by the Print… panel item on the
preview frame’s control bar.

Returns false in case of error — call
Printer#get_last_error to get detailed
information about the kind of the error.

### PrintPreview#render_page

Boolean render_page(%(arg-type)Integer% pageNum)

Renders a page into a MemoryDC. Used internally by PrintPreview.

### PrintPreview#set_canvas

set_canvas(%(arg-type)PreviewCanvas% window)

Sets the window to be used for displaying the print preview image.

### PrintPreview#set_current_page

set_current_page(%(arg-type)Integer% pageNum)

Sets the current page to be previewed.

### PrintPreview#set_frame

set_frame(%(arg-type)Frame% frame)

Sets the frame to be used for displaying the print preview canvas
and control bar.

### PrintPreview#set_printout

set_printout(%(arg-type)Printout% printout)

Associates a printout object with the PrintPreview object.

### PrintPreview#set_zoom

set_zoom(%(arg-type)Integer% percent)

Sets the percentage preview zoom, and refreshes the preview canvas
accordingly.

[This page automatically generated from the Textile source at 2023-06-09 00:45:26 +0000]