Hi,

I'm trying to print a QWebview before it is showed in the Dialog
Qt Code:
  1. QString html = getHtmlString(); // Get the HTML String
  2. ui.webView->setHtml(html); // set the Html string to the QWebView
  3.  
  4. QPrinter printer; // Create the Printer
  5. printer.setOutputFormat(QPrinter::PdfFormat);
  6. printer.setPageSize(QPrinter::A4);
  7. printer.setOrientation(QPrinter::Landscape);
  8.  
  9. QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),QCoreApplication::applicationDirPath(),tr("*.pdf"));
  10. if(fileName.length()>0 ){
  11. printer.setOutputFileName(fileName);
  12. ui.webView->print(&printer); // print the QWebview
  13. QDesktopServices::openUrl(QUrl(fileName));
  14. }
To copy to clipboard, switch view to plain text mode 

The printed html pdf is always white.
If I print the webview by pressing a button after it has been shown on the Dialog there's text in the pdf.

Can anyone help me?

Thanks,

Grisu