PDA

View Full Version : How to specify custom page margins when print with QPrinter related class



lilly_li
7th July 2009, 15:06
Dear sir,

I have written a program to print Rich text. My problem is that I want to specity my own page margins in the program, instead of use QPageSetupDialog.
But when I use
printer.printEngine()->setProperty( QPrintEngine::PPK_PageRect, QVariant( QRect(left, top, ww, hh ) ) );, where printer is QPrinter, it do nothing. So I check the function in Qt's source codes, it do nothing for QPrintEngine::PPK_PageRect ( deafult switch ).

How can I do that?

Thanks.

wysota
7th July 2009, 16:46
You can call setViewport() on the printer's painter and set the margins there.