def __init__(self, aViewer, settings, printSelectionOnly=False, *args, **kwargs): super(HTMLPrintout, self).__init__(*args, **kwargs) htmlText, count = persistence.viewer2html(aViewer, selectionOnly=printSelectionOnly) self.SetHtmlText(htmlText) self.SetFooter(_('Page') + ' @PAGENUM@/@PAGESCNT@', wx.html.PAGE_ALL) self.SetFonts('Arial', 'Courier') printerSettings = PrinterSettings(settings) top, left = printerSettings.pageSetupData.GetMarginTopLeft() bottom, right = printerSettings.pageSetupData.GetMarginBottomRight() self.SetMargins(top, bottom, left, right)
def Printout(viewer, settings, printSelectionOnly=False, twoPrintouts=False): widget = viewer.getWidget() if hasattr(widget, 'Draw'): def _printout(): return DCPrintout(widget) else: htmlText = persistence.viewer2html(viewer, settings, selectionOnly=printSelectionOnly)[0] def _printout(): return HTMLPrintout(htmlText, settings) result = _printout() if twoPrintouts: result = (result, _printout()) return result