View Full Version : How to set paper size in QPrinter (example)

22nd August 2011, 01:39

How can i set a custom paper size (for example in inches), I found a method called setPaperSize, but, i didn't know how to use it, mainly because i'm a java programmer and i'm finding hard time to accommodate with C++ :p...

Is there any example on how to use set paper size?

22nd August 2011, 03:22
QPrinter::setPaperSize() is called with the obvious parameters for a non-standard paper size:

QPrinter p;
p.setPaperSize(QSizeF(2, 3), QPrinter::Inch); // 2" x 3"
p.setPaperSize(QSizeF(144, 216), QPrinter::Point); // in points
Certainly no more complicated than Java and nothing that takes more then 30 seconds with the docs. What exactly are you having difficulty with?

22nd August 2011, 06:43
i know it's not difficult, but, i'm not familiar at all with C++ syntax and i have to modify a source.. so what i'm doing literally is imitating the code :( , it's like trying to hack a python or php code..

thx again for your help