Results 1 to 2 of 2

Thread: How to specify custom page margins when print with QPrinter related class

  1. #1
    Join Date
    Jul 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default How to specify custom page margins when print with QPrinter related class

    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
    Qt Code:
    1. printer.printEngine()->setProperty( QPrintEngine::PPK_PageRect, QVariant( QRect(left, top, ww, hh ) ) );
    To copy to clipboard, switch view to plain text mode 
    , 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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to specify custom page margins when print with QPrinter related class

    You can call setViewport() on the printer's painter and set the margins there.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 5th July 2009, 10:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.