Hi,

When i initialize QPrinter object with QPrintDialog (which enables user to select whose prefered printer) printer reports an error indicating it is an empty page. But when i choose a pdf or ps file from the same dialog, QPrinter successfully generates file. Printers are working as i'm able to print generated ps/pdf files. Error only comes when i want to print directly to printers with qt.

My qt version is: qt 4.4.3

code below does not work either:

Qt Code:
  1. #include <QApplication>
  2. #include <QtGui>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication app(argc, argv);
  7.  
  8. QPrinter printer;
  9.  
  10. QPrintDialog *dialog = new QPrintDialog(&printer, NULL);
  11. dialog->setWindowTitle("Print Dialog");
  12. if (dialog->exec() == QDialog::Accepted) {
  13. QTextDocument doc( "abcd efg" );
  14. doc.print(&printer);
  15. }
  16.  
  17. return app.exec();
  18. }
To copy to clipboard, switch view to plain text mode 

Thanks

Hayati