Пример #1
0
 def generate_pdf(self):
     """Generate a PDF from the displayed content."""
     printer = QtGui.QPrinter(QtGui.QPrinter.HighResolution)
     printer.setPageSize(QtGui.QPrinter.A4)
     printer.setColorMode(QtGui.QPrinter.Color)
     printer.setOutputFormat(QtGui.QPrinter.PdfFormat)
     report_path = unique_filename(suffix='.pdf')
     printer.setOutputFileName(report_path)
     self.print_(printer)
     url = QtCore.QUrl.fromLocalFile(report_path)
     # noinspection PyTypeChecker,PyCallByClass,PyArgumentList
     QtGui.QDesktopServices.openUrl(url)
Пример #2
0
 def generate_pdf(self):
     """Generate a PDF from the displayed content."""
     printer = QtGui.QPrinter(QtGui.QPrinter.HighResolution)
     printer.setPageSize(QtGui.QPrinter.A4)
     printer.setColorMode(QtGui.QPrinter.Color)
     printer.setOutputFormat(QtGui.QPrinter.PdfFormat)
     report_path = unique_filename(suffix='.pdf')
     printer.setOutputFileName(report_path)
     self.print_(printer)
     url = QtCore.QUrl.fromLocalFile(report_path)
     # noinspection PyTypeChecker,PyCallByClass,PyArgumentList
     QtGui.QDesktopServices.openUrl(url)