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:
#include <QApplication>
#include <QtGui>
int main(int argc, char *argv[])
{
dialog->setWindowTitle("Print Dialog");
if (dialog
->exec
() == QDialog::Accepted) { doc.print(&printer);
}
return app.exec();
}
#include <QApplication>
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPrinter printer;
QPrintDialog *dialog = new QPrintDialog(&printer, NULL);
dialog->setWindowTitle("Print Dialog");
if (dialog->exec() == QDialog::Accepted) {
QTextDocument doc( "abcd efg" );
doc.print(&printer);
}
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Thanks
Hayati
Bookmarks