Class: Wx::PRT::PrintPreview

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/prt/printer.rb

Overview

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 Wx::PRT::Printer#print, 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 DC 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 DC#get_text_extent heavily (for example, HTML::HtmlEasyPrinting and other HTML classes do) is affected. It is recommended to use native preview functionality on platforms that offer it (macOS, GTK+).

Category: Printing Framework

See Also:

Requires:

  • USE_PRINTING_ARCHITECTURE

Instance Method Summary collapse

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initialize(printout, printoutForPrinting = nil, data = nil) ⇒ Wx::PRT::PrintPreview #initialize(printout, printoutForPrinting, data) ⇒ Wx::PRT::PrintPreview

Returns a new instance of PrintPreview.

Overloads:

  • #initialize(printout, printoutForPrinting = nil, data = nil) ⇒ Wx::PRT::PrintPreview

    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 Wx::PRT::PrintPreview destructor. The same does not apply to the data argument.

    Use #is_ok to check whether the Wx::PRT::PrintPreview object was created correctly.

    Parameters:

  • #initialize(printout, printoutForPrinting, data) ⇒ Wx::PRT::PrintPreview

    Parameters:



401
# File 'lib/wx/doc/gen/prt/printer.rb', line 401

def initialize(*args) end

Instance Method Details

#get_canvaswxScrolledWindow Also known as: canvas

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

Returns:

  • (wxScrolledWindow)


405
# File 'lib/wx/doc/gen/prt/printer.rb', line 405

def get_canvas; end

#get_current_pageInteger Also known as: current_page

Gets the page currently being previewed.

Returns:

  • (Integer)


410
# File 'lib/wx/doc/gen/prt/printer.rb', line 410

def get_current_page; end

#get_frameWx::Frame Also known as: frame

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

Returns:



415
# File 'lib/wx/doc/gen/prt/printer.rb', line 415

def get_frame; end

#get_max_pageInteger Also known as: max_page

Returns the maximum page number.

Returns:

  • (Integer)


420
# File 'lib/wx/doc/gen/prt/printer.rb', line 420

def get_max_page; end

#get_min_pageInteger Also known as: min_page

Returns the minimum page number.

Returns:

  • (Integer)


425
# File 'lib/wx/doc/gen/prt/printer.rb', line 425

def get_min_page; end

#get_printoutWx::PRT::Printout Also known as: printout

Gets the preview printout object associated with the Wx::PRT::PrintPreview object.

Returns:



430
# File 'lib/wx/doc/gen/prt/printer.rb', line 430

def get_printout; end

#get_printout_for_printingWx::PRT::Printout Also known as: printout_for_printing

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

Returns:



435
# File 'lib/wx/doc/gen/prt/printer.rb', line 435

def get_printout_for_printing; end

#get_zoomInteger Also known as: zoom

Gets the current percentage zoom level of the preview canvas.

Returns:

  • (Integer)

See Also:



443
# File 'lib/wx/doc/gen/prt/printer.rb', line 443

def get_zoom; end

#is_okBoolean Also known as: ok?

Returns true if the Wx::PRT::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).

Returns:

  • (Boolean)


450
# File 'lib/wx/doc/gen/prt/printer.rb', line 450

def is_ok; end

Invokes the print process using the second Wx::PRT::Printout object supplied in the Wx::PRT::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 Wx::PRT::Printer.get_last_error to get detailed information about the kind of the error.

Parameters:

  • prompt (Boolean)

Returns:

  • (Boolean)


459
# File 'lib/wx/doc/gen/prt/printer.rb', line 459

def print(prompt) end

#render_page(pageNum) ⇒ Boolean

Renders a page into a MemoryDC.

Used internally by Wx::PRT::PrintPreview.

Parameters:

  • pageNum (Integer)

Returns:

  • (Boolean)


466
# File 'lib/wx/doc/gen/prt/printer.rb', line 466

def render_page(pageNum) end

#set_current_page(pageNum) ⇒ Boolean Also known as: current_page=

Sets the current page to be previewed.

Parameters:

  • pageNum (Integer)

Returns:

  • (Boolean)


471
# File 'lib/wx/doc/gen/prt/printer.rb', line 471

def set_current_page(pageNum) end

#set_frame(frame) ⇒ void Also known as: frame=

This method returns an undefined value.

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

Parameters:



477
# File 'lib/wx/doc/gen/prt/printer.rb', line 477

def set_frame(frame) end

#set_printout(printout) ⇒ void Also known as: printout=

This method returns an undefined value.

Associates a printout object with the Wx::PRT::PrintPreview object.

Parameters:



483
# File 'lib/wx/doc/gen/prt/printer.rb', line 483

def set_printout(printout) end

#set_zoom(percent) ⇒ void Also known as: zoom=

This method returns an undefined value.

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

Parameters:

  • percent (Integer)

See Also:



492
# File 'lib/wx/doc/gen/prt/printer.rb', line 492

def set_zoom(percent) end