I'm printing blank pages with QWebView
Hello everybody,
I'm trying to print a HTML page from QWebView but it always prints nothing but an
empty page
Code:
{
view = new QWebView;
view
->load
(QUrl("page.html"));
view->show();
connect(view,SIGNAL(loadFinished(bool)),this,SLOT(loadFinished()));
}
void Test::loadFinished()
{
qDebug()<<"load finished";
dialog.exec();
view->print(&printer);
}
Can any one help me with this problem
Re: I'm printing blank pages with QWebView
Try QUrl::fromLocalFile() and make sure QFile::exits() returns true for the files you use.
Re: I'm printing blank pages with QWebView
I am trying to print an image file on printer using QWebview but instead of image blank page is printed. Please find the below code.
Code:
void ChartViewer::onprintBtnClicked()
{
qDebug()<<"Print file name is "<<fileName;
if(fileName.endsWith(".png"))
{
QWebView *view = new QWebView;
printer.setOutputFileName(fileName);
if(dlg
->exec
() != QDialog::Accepted) return;
view->load(fileName);
view->print(&printer);
}
}
If I use view->show() then it has shown the image properly but printed page is coming blank. Request you to please look into the above code and correct me where I am doing wrong.
Re: I'm printing blank pages with QWebView
Quote:
Request you to please look into the above code and correct me where I am doing wrong.
Including the two blatant memory leaks that happen every time the print button is clicked?
Code:
QWebView *view = new QWebView;