I store in QTextDocument some images and text , i use the function print , to print this document into a paper.

I try to make a PDF file with the new function in QPrinter , setOutputFormat(QPrinter::PdfFormat) , but it doesn't work.

I also would like to make a PNG file of this document.

My question is , How to convert QTextDocument to PNG file?