# wxHtmlEasyPrinting Class Reference
[HTML, Printing Framework]

`#include <wx/html/htmprint.h>`

Inheritance diagram for wxHtmlEasyPrinting:
[legend]

## Detailed Description

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.

##

Library: wxHTML

Category: HTML, Printing Framework

## Public Member Functions
| wxHtmlEasyPrinting (const wxString &name="Printing", wxWindow *parentWindow=NULL)
| Constructor.
const wxString & | GetName () const
| Returns the current name being used for preview frames and setup dialogs.
wxPageSetupDialogData * | GetPageSetupData ()
| Returns a pointer to wxPageSetupDialogData instance used by this class.
wxWindow * | GetParentWindow () const
| Gets the parent window for dialogs.
wxPrintData * | GetPrintData ()
| Returns pointer to wxPrintData instance used by this class.
void | PageSetup ()
| Display page setup dialog and allows the user to modify settings.
bool | PreviewFile (const wxString &htmlfile)
| Preview HTML file.
bool | PreviewText (const wxString &htmltext, const wxString &basepath=wxEmptyString)
| Preview HTML text (not file!).
bool | PrintFile (const wxString &htmlfile)
| Print HTML file.
bool | PrintText (const wxString &htmltext, const wxString &basepath=wxEmptyString)
| Print HTML text (not file!).
void | SetFonts (const wxString &normal_face, const wxString &fixed_face, const int *sizes=NULL)
| Sets fonts.
void | SetName (const wxString &name)
| Sets the name used for preview frames and setup dialogs.
void | SetStandardFonts (int size=-1, const wxString &normal_face=wxEmptyString, const wxString &fixed_face=wxEmptyString)
| Sets default font sizes and/or default font size.
void | SetFooter (const wxString &footer, int pg=wxPAGE_ALL)
| Set page footer.
void | SetHeader (const wxString &header, int pg=wxPAGE_ALL)
| Set page header.
void | SetParentWindow (wxWindow *window)
| Sets the parent window for dialogs.

List of all members.

## Constructor & Destructor Documentation

wxHtmlEasyPrinting::wxHtmlEasyPrinting | ( | const wxString & | name = `"Printing"`,
|  | wxWindow * | parentWindow = `NULL` |
| ) |  |  |

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.

## Member Function Documentation

const wxString& wxHtmlEasyPrinting::GetName | ( |  | ) | const

Returns the current name being used for preview frames and setup dialogs.

Since:
  2.8.11 / 2.9.1

wxPageSetupDialogData* wxHtmlEasyPrinting::GetPageSetupData | ( |  | ) |

Returns a pointer to wxPageSetupDialogData instance used by this class.

You can set its parameters (via SetXXXX methods).

wxWindow* wxHtmlEasyPrinting::GetParentWindow | ( |  | ) | const

Gets the parent window for dialogs.

wxPrintData* wxHtmlEasyPrinting::GetPrintData | ( |  | ) |

Returns pointer to wxPrintData instance used by this class.

You can set its parameters (via SetXXXX methods).

void wxHtmlEasyPrinting::PageSetup | ( |  | ) |

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

bool wxHtmlEasyPrinting::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.

bool wxHtmlEasyPrinting::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.

bool wxHtmlEasyPrinting::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.

bool wxHtmlEasyPrinting::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.

void wxHtmlEasyPrinting::SetFonts | ( | const wxString & | normal_face,
|  | const wxString & | fixed_face,
|  | const int * | sizes = `NULL` |
| ) |  |  |

Sets fonts.

See wxHtmlDCRenderer::SetFonts for detailed description.

void wxHtmlEasyPrinting::SetFooter | ( | const wxString & | footer,
|  | int | pg = `wxPAGE_ALL` |
| ) |  |  |

Set page footer.

The following macros can be used inside it: @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

Parameters:

  | footer | HTML text to be used as footer.
  | pg | one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.

void wxHtmlEasyPrinting::SetHeader | ( | const wxString & | header,
|  | int | pg = `wxPAGE_ALL` |
| ) |  |  |

Set page header.

The following macros can be used inside it:

- @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

Parameters:

  | header | HTML text to be used as header.
  | pg | one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.

void wxHtmlEasyPrinting::SetName | ( | const wxString & | name | ) |

Sets the name used for preview frames and setup dialogs.

Since:
  2.8.11 / 2.9.1

void wxHtmlEasyPrinting::SetParentWindow | ( | wxWindow * | window | ) |

Sets the parent window for dialogs.

void wxHtmlEasyPrinting::SetStandardFonts | ( | int | size = `-1`,
|  | const wxString & | normal_face = `wxEmptyString`,
|  | const wxString & | fixed_face = `wxEmptyString` |
| ) |  |  |

Sets default font sizes and/or default font size.

See wxHtmlDCRenderer::SetStandardFonts for detailed description.

See also:
  SetFonts()

|  | [ top ]