Print QTextEdit and QGraphicsView as pdf(PtQT)



  • My Question is I am trying to print an image from QGraphicsView and Qtextedit into same pdf file, how can I achieve that?I tried some ways, but always seemed to fail.
    I can do both but separately!
    Any Help?
    Thanks!!!

    save graphicsview
    @ def savePNG(self):

        out = QPixmap(2000,2000)
        self.tmp.append(out)
        paint = QPainter(out)
        self.tmp.append(paint)
        
        targ = QRectF(0,0,2000,2000)
        src = QRect(0,0,2000,2000)
        paint.fillRect(targ, Qt.white)
        self.graphicsViewz.render(paint,targ,src)
        @
    

    save pdf method:
    @def savePDF(self):
    filename = self.saveDialog()
    if filename.isEmpty():
    return
    printer = QPrinter()
    printer.setPageSize(QPrinter.Letter)
    printer.setOutputFormat(QPrinter.PdfFormat)
    printer.setOutputFileName(filename)
    self.scanInfo.print_(printer)--@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.