def get_pdf( self ): self.config_printer() self.printer.setOutputFormat( QtGui.QPrinter.PdfFormat ) filepath = OpenFile.create_temporary_file('.pdf') self.printer.setOutputFileName(filepath) self.document.print_(self.printer) return filepath
def get_pdf(self, filename=None): printer = QtPrintSupport.QPrinter() printer.setOutputFormat(QtPrintSupport.QPrinter.PdfFormat) self.config_printer(printer) if filename is None: filename = OpenFile.create_temporary_file('.pdf') printer.setOutputFileName(filename) self.paint_on_printer(printer) return filename
def get_pdf( self ): doc = QtGui.QTextDocument() doc.setHtml(self.template.render( self.context )) printer = QtGui.QPrinter() printer.setOutputFormat( QtGui.QPrinter.PdfFormat ) filepath = OpenFile.create_temporary_file('.pdf') printer.setOutputFileName(filepath) doc.print_(printer) return filepath