python - TableView to PDF (Several Pages) -
i hitting major road block trying export finish tableview pyqt app pdf.
i've been able sort of pdf exports, come out trimmed current viewing area.
i looking illustration export finish tableview if visible @ moment of export.
i have thumbnails in tableview, guess captures visible images.
this code have sofar, manages export pdf portion of tableview. hints appreciated!
def _print(self, checked = none): if checked == none: homecoming filename = qtgui.qfiledialog.getsavefilename(self, 'save file', '', 'pdf files (*.pdf)') if filename == '': homecoming #set qprinter p = qtgui.qprinter(qtgui.qprinter.highresolution) p.setpapersize(qtgui.qprinter.a4) p.setoutputformat(qtgui.qprinter.pdfformat) p.setorientation(qtgui.qprinter.landscape) p.setoutputfilename(filename) #set painter painter = qtgui.qpainter() #activate painter paint on p give visual conformation worked or not. #if didn't work homecoming out of method. if painter.begin(p) == false: msgbox = qtgui.qmessagebox() msgbox.settext('an error occoured while creating pdf') msgbox.setinformativetext('could not save pdf') msgbox.seticon(qtgui.qmessagebox.critical) msgbox.exec_() homecoming #self.shottableview.scale(200, 200); #painter.begin(printer) print self.shottableview.width() xscale = (self.shottableview.width() / 50); yscale = (self.shottableview.height() / 50); #scale = qmin(xscale, yscale); painter.scale(xscale, yscale); self.shottableview.render(painter) painter.end()
python pyqt
No comments:
Post a Comment