Results 1 to 3 of 3

Thread: How to set paper size in QPrinter (example)

  1. #1
    Join Date
    Aug 2011
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question How to set paper size in QPrinter (example)

    Hi,

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

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

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to set paper size in QPrinter (example)

    QPrinter::setPaperSize() is called with the obvious parameters for a non-standard paper size:
    Qt Code:
    1. p.setPaperSize(QSizeF(2, 3), QPrinter::Inch); // 2" x 3"
    2. p.setPaperSize(QSizeF(144, 216), QPrinter::Point); // in points
    To copy to clipboard, switch view to plain text mode 
    Certainly no more complicated than Java and nothing that takes more then 30 seconds with the docs. What exactly are you having difficulty with?

  3. #3
    Join Date
    Aug 2011
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set paper size in QPrinter (example)

    thx;
    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

Similar Threads

  1. How do I set a custom page/paper size in QPrinter
    By alferjaani in forum Qt Programming
    Replies: 7
    Last Post: 26th July 2013, 04:42
  2. QPrinter: Print vs. PDF paper size
    By LynneV in forum Qt Programming
    Replies: 0
    Last Post: 3rd February 2011, 15:15
  3. How I setup QPrinter paper margins
    By vcp in forum Qt Programming
    Replies: 3
    Last Post: 15th May 2008, 17:43
  4. QPrinter::PrinterMode and QPrinter::setResolution??
    By SkripT in forum Qt Programming
    Replies: 2
    Last Post: 28th April 2006, 11:59
  5. Replies: 16
    Last Post: 25th April 2006, 12:41

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
  •  
Qt is a trademark of The Qt Company.