Hello,
I created a dialog with an HTML window that shows exactly what I want to print. I tested two methods of how to print (after reading through a lot of stuff). Both methods just print out the plain html code but not the interpretation the HTML window is showing (self.html_page is a wx.html.HtmlWindow).
Version 1:
printout = wx.html.HtmlPrintout()
printout.SetHtmlText(self.html_page.ToText())
pd = wx.PrintDialog(self.frame)
printer = wx.Printer(pd.GetPrintDialogData())
printer.Print(self.frame, printout)
Version 2:
test = html.HtmlEasyPrinting(self.frame.g_char.char_name, self.frame)
# Set some default printer and page options.
test.GetPrintData().SetPaperId(wx.PAPER_A4)
test.GetPrintData().SetOrientation(wx.PORTRAIT)
# Black and white printing if False.
test.GetPrintData().SetColour(False)
test.GetPageSetupData().SetMarginTopLeft((20, 20))
test.GetPageSetupData().SetMarginBottomRight((20, 20))
test.PrintText(self.html_page.ToText())
It seems I do not understand what HTML printing means for wxPython? I thought if a class is named to print html it would do so. What did I get wrong? How to fix this?
Thanks, Isrem.