title: How to print image file from a printer using QT
body: <p>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. </p>
  
  <pre><code>void ChartViewer::onprintBtnClicked()
  {
      QString fileName = QFileDialog::getOpenFileName(this,"Open File",QString(),"Pdf File(*.png)");
      qDebug()&lt;&lt;"Print file name is "&lt;&lt;fileName;
      if(fileName.endsWith(".png"))
      {
          QPrinter printer;
          QWebView *view = new QWebView;
          QPrintDialog *dlg = new QPrintDialog(&amp;printer,this);
          printer.setOutputFileName(fileName);
          if(dlg-&gt;exec() != QDialog::Accepted)
              return;
          view-&gt;load(fileName);
          view-&gt;print(&amp;printer);
      }
  }
  </code></pre>
  
  <p>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.</p>
  
  <p>Regards,
  Lekhraj</p>