Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Print QTextEdit and QGraphicsView as pdf(PtQT)

Print QTextEdit and QGraphicsView as pdf(PtQT)

Scheduled Pinned Locked Moved Language Bindings
1 Posts 1 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ImOnFire
    wrote on last edited by
    #1

    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)--@

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved