1

I'm working on an app that will display an image and some text. But I want to export the whole QT interface as a PDF (By pressing on a button on the UI itself). All the text and all the images just as it appears on the UI.

Now if that isn't possible, maybe I can some how automatically create a jpg, save it and then somehow, using reportlab, to convert the jpg to a PDF.

I have no idea where to start. Can any one please give me an example or even just a hint.

1 Answer 1

2

You can use QPixmap.grabWidget to capture you main window widget and QPrinter to produce a pdf file. A QPainter is needed to draw the pixmap to the printer.

1
  • Thanks this seems to work, I got the grabWidget to work, now just to convert to pdf or print. Here is a short part I added to my code to save as image. Thanks again. im = QPixmap.grabWidget(self); im.save('C:/test.png')
    – Jacobus
    Nov 11, 2013 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.