wxPrintPreview

wxPrintPreview

Creation Parameters

If wxPrintout is non-null, then a Print... button will be placed on the preview frame so that the user can print directly from the preview interface

If wxPreviewFrame is not supplied, one will be created, which can be accessed through get_preview_frame]

Previewing is started by showing the preview frame.

Properly scaling the print preview is fairly simple. There are three pieces of data that are required:

  1. get_dc_size()
  2. get_page_pixels()
  3. get_ppi_printer()

You can get the scaling factor required by dividing the results of get_dc_size() by get_page_pixels(). Pass the result to set_user_scale(). Now, you can use coordinates in inches multiplied by the printer ppi (relative to the margins):

Example:


    procedure onPrintPage( atom this, atom page, atom dc )
        sequence ppi, factor

         ppi = get_ppi_printer( this )
         if is_preview( this ) then
             factor = get_dc_size( dc ) / get_page_pixels( this )
             set_user_scale( dc, factor[1], factor[2] )
         else
             set_user_scale( dc, 1, 1)
         end if

         -- print "Hello World" at 1", 1"
          wx_puts( 0 & ppi * {1,1} & dc, "Hello World" )
    end procedure

Functions/Procedures
Supertopics

wxPrintPreview

[func]
get_preview_frame
( atom preview )

Category: wxPrintPreview

This returns an integer which serves as a pointer to the wxPrintPreview.


wxPrintPreview

[func]
get_zoom
( atom preview )

Category: wxPrintPreview

Gets the percentage preview zoom.


wxPrintPreview

[proc]
set_preview_frame
( atom preview, atom frame )

Category: wxPrintPreview

This sets the selected wxPrintPreview to be a print previewer for the specified wxFrame.