PDA

View Full Version : QPritner, as-is in a book



giusepped
18th June 2008, 10:49
I jsut copied a code found in a book on Qt (5 stars ranking in Amazon!).
[

void PrintWindow::printHtml(const QString &html)

{
QPrintDialog printDialog(&printer,this);
if (printDialog.exec())
{
QPainter painter;
painter.begin(&printer);
QTextDocument textDocument;
textDocument.setHtml(html);
textDocument.print(&printer);
}

}


The dialog opens, but nothing will be printed. Same, if I try to print on a file (ps or pdf). The file cannot be read by kpdf or acrobat, and the printer does not start.
Any suggestion?

jacek
23rd June 2008, 00:20
Does richtext/orderform example work for you?