Hi
I'm using QTextEditor to format text for printing. After that I'm sending this text as html QString to print method.
On PrintButton click: emit signal_PrintFormatedText(htmlText);
Inside print method I have:
Code:
QPrinter printer; QTextDocument doc; doc.documentLayout()->setPaintDevice(painter.device()); doc.setHtml(htmlFormatedText); QSizeF paperSize; paperSize.setWidth(printer.width()); paperSize.setHeight(printer.height()); doc.setPageSize(paperSize); doc.drawContents(&painter);
On first time (first printing) everything works fine. Problem is when I press PrintButton (in my app) once again. Printer prints some junk characters instead of first line of document.
What is the problem? How to fix it?