QPrinter generates empty page
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:
Code:
#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();
}
Thanks
Hayati
Re: QPrinter generates empty page
You should do some error checking.
Use these steps:
1. Find the state of printer just before printing.
2. Check for general connectivity of printer with your machine. Try to print a test page from your machine.
3. Use:
Re: QPrinter generates empty page
Quote:
Originally Posted by
yogeshgokul
You should do some error checking.
Use these steps:
1. Find the state of printer just before printing.
is Idle so it's ok to send documents.
Quote:
Originally Posted by
yogeshgokul
2. Check for general connectivity of printer with your machine. Try to print a test page from your machine.
I am able to print documents from the printer.
Quote:
Originally Posted by
yogeshgokul
returns true.
change log from qt 4.4.3 to 4.5.0 is below (QPrinter):
- QPrinter
* [232415] Fixed a problem that caused a an invalid QPrinter
object to not update its validity after being passed into a
QPrintDialog.
* [215401] Fixed the size of the Executive paper format.
* [202113] Improved speed when printing to a highres PostScript printer.
* [195028] Trying to print to a non-existing file didn't update the validity
of the QPrinter object correctly.
* [134820] Support CUPS printer instances on Unix systems (Mac and X11).
* [201875] Fixed a bug that caused the fill opacity of a brush to be used
for the stroke in certain cases.
* [222056] Fixed absolute letter spacing when printing.
* [234135] Fixed a problem with custom margins for CUPS printers.
does anybody have the same problem with me with the same qt version. i'm not willing to upgrade my qt version.
I should mention that i'm using a network printer, but as i mentioned before i'm able to print documents from this printer.
Re: QPrinter generates empty page
in addition,
as i observed so far, i am able to send print jobs to printer (both from cups server and printer status dialog of operating system). but printer complains about empty page. so i suspect about something else other than QPrinter as it's valid and Qt successfully sends document to specified printer. But the problem is, file generated is empty!