wx.html.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.
Class Hierarchy¶
Methods Summary¶
Constructor. |
|
Returns the current name being used for preview frames and setup dialogs. |
|
Returns a pointer to wx.PageSetupDialogData instance used by this class. |
|
Gets the parent window for dialogs. |
|
Returns pointer to wx.PrintData instance used by this class. |
|
Display page setup dialog and allows the user to modify settings. |
|
Preview HTML file. |
|
Preview HTML text (not file!). |
|
Print HTML file. |
|
Print HTML text (not file!). |
|
Sets fonts. |
|
Set page footer. |
|
Set page header. |
|
Sets the name used for preview frames and setup dialogs. |
|
Sets the parent window for dialogs. |
|
Enable or disable showing the dialog before printing. |
|
Sets default font sizes and/or default font size. |
Properties Summary¶
See |
|
See |
|
See |
Class API¶
- class wx.html.HtmlEasyPrinting(Object)¶
Possible constructors:
HtmlEasyPrinting(name="Printing", parentWindow=None) -> None
This class provides very simple interface to printing architecture.
Methods¶
- __init__(self, name='Printing', parentWindow=None)¶
Constructor.
- Parameters:
name (string) – Name of the printing object. Used by preview frames and setup dialogs.
parentWindow (wx.Window) – pointer to the window that will own the preview frame and setup dialogs. May be
None
.
- Return type:
None
- GetName(self)¶
Returns the current name being used for preview frames and setup dialogs.
- Return type:
str
Added in version 2.8.11: / 2.9.1
- GetPageSetupData(self)¶
Returns a pointer to wx.PageSetupDialogData instance used by this class.
You can set its parameters (via SetXXXX methods).
- Return type:
PageSetupDialogData
- GetParentWindow(self)¶
Gets the parent window for dialogs.
- Return type:
Window
- GetPrintData(self)¶
Returns pointer to wx.PrintData instance used by this class.
You can set its parameters (via SetXXXX methods).
- Return type:
- PageSetup(self)¶
Display page setup dialog and allows the user to modify settings.
- Return type:
None
- PreviewFile(self, htmlfile)¶
Preview HTML file.
Returns
False
in case of error – callwx.Printer.GetLastError
to get detailed information about the kind of the error.- Parameters:
htmlfile (string)
- Return type:
bool
- PreviewText(self, htmltext, basepath='')¶
Preview HTML text (not file!).
Returns
False
in case of error – callwx.Printer.GetLastError
to get detailed information about the kind of the error.- Parameters:
htmltext (string) – HTML text.
basepath (string) – base directory (html string would be stored there if it was in file). It is used to determine path for loading images, for example.
- Return type:
bool
- PrintFile(self, htmlfile)¶
Print HTML file.
Returns
False
in case of error – callwx.Printer.GetLastError
to get detailed information about the kind of the error.- Parameters:
htmlfile (string)
- Return type:
bool
- PrintText(self, htmltext, basepath='')¶
Print HTML text (not file!).
Returns
False
in case of error – callwx.Printer.GetLastError
to get detailed information about the kind of the error.- Parameters:
htmltext (string) – HTML text.
basepath (string) – base directory (html string would be stored there if it was in file). It is used to determine path for loading images, for example.
- Return type:
bool
- SetFonts(self, normal_face, fixed_face, sizes)¶
Sets fonts.
See
wx.html.HtmlDCRenderer.SetFonts
for detailed description.- Parameters:
normal_face (string)
fixed_face (string)
sizes (list of integers)
- Return type:
None
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 (string) – HTML text to be used as footer.
pg (int) – one of
wx.html.PAGE_ODD
,wx.html.PAGE_EVEN
andwx.html.PAGE_ALL
constants.
- Return type:
None
- SetHeader(self, header, pg=PAGE_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 (string) – HTML text to be used as header.
pg (int) – one of
wx.html.PAGE_ODD
,wx.html.PAGE_EVEN
andwx.html.PAGE_ALL
constants.
- Return type:
None
- SetName(self, name)¶
Sets the name used for preview frames and setup dialogs.
- Parameters:
name (string)
- Return type:
None
Added in version 2.8.11: / 2.9.1
- SetParentWindow(self, window)¶
Sets the parent window for dialogs.
- Parameters:
window (wx.Window)
- Return type:
None
- SetPromptMode(self, promptMode)¶
Enable or disable showing the dialog before printing.
The prompt mode determines the value of the
prompt
parameter passed towx.Printer.Print
when it is called by this class.Default prompt mode value is Prompt_Always.
- Parameters:
promptMode (PromptMode)
- Return type:
None
Added in version 4.1/wxWidgets-3.1.2.
- SetStandardFonts(self, size=-1, normal_face='', fixed_face='')¶
Sets default font sizes and/or default font size.
See
wx.html.HtmlDCRenderer.SetStandardFonts
for detailed description.- Parameters:
size (int)
normal_face (string)
fixed_face (string)
- Return type:
None
See also
Properties¶
- PageSetupData¶
See
GetPageSetupData
- ParentWindow¶
See
GetParentWindow
andSetParentWindow
- PrintData¶
See
GetPrintData