[Qt-interest] QPrinter setFullPage(): Win/Linux Diffs
Chris W
qtinterest at psychogeeks.com
Wed Sep 9 01:07:05 CEST 2009
Hello All
I'm having a bit of fun with cross-platform differences in printing. I
use QPrinter::setFullPage() to allow me to place a full-page sized
template of a complex form (from an SVG file) on the page. On Linux it
works fine. On Windows the template image is offset because, apparently,
full page does not mean that on Windows (except when the print is
directed to PDF). This test code:
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPrinter p(QPrinter::HighResolution);
p.setPaperSize(QPrinter::A4);
p.setOrientation(QPrinter::Landscape);
p.setFullPage(true);
qDebug() << "Page rect: " << p.pageRect();
qDebug() << "Paper rect: " << p.paperRect();
QWidget mainWin;
mainWin.show();
return app.exec();
}
On Linux prints equal page and paper rectangles as the docs imply:
Page rect: QRect(0,0 14033x9917)
Paper rect: QRect(0,0 14033x9917)
and Windows:
Page rect: QRect(99,99 6814x4760)
Paper rect: QRect(0,0 7016x4961)
Firstly, can others confirm this behaviour? Is it a bug, or have I
missed something in the docs?
Secondly, is the only way around this to let Windows have its ~5mm
border* all round, force the same on Linux, and shrink my template
accordingly?
Regards,
Chris W
* Actually it will have to be at least as large as the largest printer
border the app is likely to encounter because I guess the figures come
from the printer driver on Windows.
** Qt 4.5.2 on Linux. Qt 4.5.2 in Qt SDK 2009.03 on Windows
More information about the Qt-interest-old
mailing list