## wxHtmlEasyPrinting

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

wxObject

Include files

<wx/html/htmprint.h>

Members

wxHtmlEasyPrinting::wxHtmlEasyPrinting
wxHtmlEasyPrinting::PreviewFile
wxHtmlEasyPrinting::PreviewText
wxHtmlEasyPrinting::PrintFile
wxHtmlEasyPrinting::PrintText
wxHtmlEasyPrinting::PrinterSetup
wxHtmlEasyPrinting::PageSetup
wxHtmlEasyPrinting::SetHeader
wxHtmlEasyPrinting::SetFooter
wxHtmlEasyPrinting::GetPrintData
wxHtmlEasyPrinting::GetPageSetupData

### wxHtmlEasyPrinting::wxHtmlEasyPrinting

wxHtmlEasyPrinting(const wxString& name = "Printing", wxFrame* parent_frame = NULL)

Constructor.

Parameters

name

Name of the printing. Used by preview frames and setup dialogs.

parent_frame

pointer to the frame that will own preview frame and setup dialogs. May be NULL.

### wxHtmlEasyPrinting::PreviewFile

bool PreviewFile(const wxString& htmlfile)

Preview HTML file.

Returns FALSE in case of error -- call wxPrinter::GetLastError to get detailed information about the kind of the error.

### wxHtmlEasyPrinting::PreviewText

bool PreviewText(const wxString& htmltext, const wxString& basepath = wxEmptyString)

Preview HTML text (not file!).

Returns FALSE in case of error -- call wxPrinter::GetLastError 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.

### wxHtmlEasyPrinting::PrintFile

bool PrintFile(const wxString& htmlfile)

Print HTML file.

Returns FALSE in case of error -- call wxPrinter::GetLastError to get detailed information about the kind of the error.

### wxHtmlEasyPrinting::PrintText

bool PrintText(const wxString& htmltext, const wxString& basepath = wxEmptyString)

Print HTML text (not file!).

Returns FALSE in case of error -- call wxPrinter::GetLastError 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.

### wxHtmlEasyPrinting::PrinterSetup

void PrinterSetup()

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

### wxHtmlEasyPrinting::PageSetup

void PageSetup()

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

### wxHtmlEasyPrinting::SetHeader

void SetHeader(const wxString& header, int pg = wxPAGE_ALL)

Set page header.

Parameters

header

HTML text to be used as header. You can use macros in it:

- @PAGENUM@ is replaced by page number
- @PAGESCNT@ is replaced by total number of pages

pg

one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.

### wxHtmlEasyPrinting::SetFooter

void SetFooter(const wxString& footer, int pg = wxPAGE_ALL)

Set page footer.

Parameters

footer

HTML text to be used as footer. You can use macros in it:

- @PAGENUM@ is replaced by page number
- @PAGESCNT@ is replaced by total number of pages

pg

one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.

### wxHtmlEasyPrinting::GetPrintData

wxPrintData* GetPrintData()

Returns pointer to wxPrintData instance used by this class. You can set its parameters (via SetXXXX methods).

### wxHtmlEasyPrinting::GetPageSetupData

wxPageSetupDialogData* GetPageSetupData()

Returns a pointer to wxPageSetupDialogData instance used by this class. You can set its parameters (via SetXXXX methods).