wxRuby Documentation Home

# Wx::HtmlEasyPrinting

This class provides very simple interface to printing
architecture. It allows you to print HTML documents using
only a few commands.

## Note

Do not create this class on the stack only. You should create an instance on app
startup and use this instance for all printing operations. The reason is that
this class stores various settings in it.

## Derived from

Object

## Methods

- HtmlEasyPrinting.new
- HtmlEasyPrinting#preview_file
- HtmlEasyPrinting#preview_text
- HtmlEasyPrinting#print_file
- HtmlEasyPrinting#print_text
- HtmlEasyPrinting#page_setup
- HtmlEasyPrinting#set_fonts
- HtmlEasyPrinting#set_header
- HtmlEasyPrinting#set_footer
- HtmlEasyPrinting#get_print_data
- HtmlEasyPrinting#get_page_setup_data

### HtmlEasyPrinting.new

HtmlEasyPrinting.new(%(arg-type)String% name = “Printing”, Window parentWindow = nil)

Constructor.

#### Parameters

- name Name of the printing object. Used by preview frames and setup dialogs.
- parentWindow pointer to the window that will own the preview frame and setup dialogs. May be NULL.

### HtmlEasyPrinting#preview_file

Boolean preview_file(%(arg-type)String% htmlfile)

Preview HTML file.

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

### HtmlEasyPrinting#preview_text

Boolean preview_text(%(arg-type)String% htmltext, String basepath = ’’)

Preview HTML text (not file!).

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

#### Parameters

- htmltext HTML text.
- basepath base directory (html string would be stored there if it was in
  file). It is used to determine path for loading images, for example.

### HtmlEasyPrinting#print_file

Boolean print_file(%(arg-type)String% htmlfile)

Print HTML file.

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

### HtmlEasyPrinting#print_text

Boolean print_text(%(arg-type)String% htmltext, String basepath = ’’)

Print HTML text (not file!).

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

#### Parameters

- htmltext HTML text.
- basepath base directory (html string would be stored there if it was in
  file). It is used to determine path for loading images, for example.

### HtmlEasyPrinting#page_setup

page_setup()

Display page setup dialog and allows the user to modify settings.

### HtmlEasyPrinting#set_fonts

set_fonts(%(arg-type)String% normal_face, String fixed_face, Integer sizes = nil)

Sets fonts. See HtmlWindow#set_fonts for
detailed description.

### HtmlEasyPrinting#set_header

set_header(%(arg-type)String% header, Integer page = `Wx::PAGE_ALL`)

Sets the page header to the text header. The header can contain HTML
markup. It can also include placeholders, wrapped in the @ sign,
which be will replaced on each page.

- @DATE@ is replaced by the current date in default format
- @PAGENUM@ is replaced by page number
- @PAGESCNT@ is replaced by total number of pages
- @TIME@ is replaced by the current time in default format
- @TITLE@ is replaced with the title of the document

The page parameter can be used to control which set of pages the
header is set for. It can be one of the constants `Wx::PAGE_ODD`, `Wx::PAGE_EVEN` or `Wx::PAGE_ALL`.

### HtmlEasyPrinting#set_footer

set_footer(%(arg-type)String% footer, Integer page = `Wx::PAGE_ALL`)

Sets the page footer to the text footer. The footer can contain HTML
markup. It can also include placeholders, wrapped in the @ sign,
which be will replaced on each page.

- @DATE@ is replaced by the current date in default format
- @PAGENUM@ is replaced by page number
- @PAGESCNT@ is replaced by total number of pages
- @TIME@ is replaced by the current time in default format
- @TITLE@ is replaced with the title of the document

The page parameter can be used to control which set of pages the
footer is set for. It can be one of the constants `Wx::PAGE_ODD`,
`Wx::PAGE_EVEN` or `Wx::PAGE_ALL`.

### HtmlEasyPrinting#get_print_data

PrintData get_print_data()

Returns the PrintData instance used by this class. You can
set its parameters (using its set_xxx methods).

### HtmlEasyPrinting#get_page_setup_data

PageSetupDialogData get_page_setup_data()

Returns the PageSetupDialogData instance used by
this class. You can set its parameters (using its set_xxx methods).

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