PDA

View Full Version : QPrinter setFullPage(): Win/Linux Diffs



ChrisW67
4th September 2009, 03:28
Hi 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:

Page rect: QRect(0,0 14033x9917)
Paper rect: QRect(0,0 14033x9917)

as the docs imply, and Windows:

Page rect: QRect(99,99 6814x4760)
Paper rect: QRect(0,0 7016x4961)


Firstly, can others confirm this behaviour? 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?

* 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.

ChrisW67
11th September 2009, 03:39
Thanks to those who have read this post.

I think it is a bug and will report it.

ChrisW67
9th October 2009, 05:31
I thought I'd bump this and see if anyone has any ideas.

I reported an error to Nokia (#261362) but, despite receiving an auto-response, it has not appeared in the task tracker. Is that normal?