Results 1 to 4 of 4

Thread: PyQt5 QPrinting setFullpage doesn't works

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2017
    Posts
    11
    Qt products
    Qt5
    Platforms
    Windows

    Default PyQt5 QPrinting setFullpage doesn't works

    Hi, newbie on the forums and also newbie at Qt programming.

    I am here because I have a problem, (which I researched for a fix and I am aware it's the same issue as This one on C++) and I can't find a way to fix on Python 3.5.

    The issue: When I try to print my widget to a PDF the result is this one:
    It should fit the entire A4 page but it resizes it to that small section (yeah, that red rectangle).
    MzSHRX75RRSmfkvcgucxLQ.jpg

    The code:
    Qt Code:
    1. from PyQt5.QtGui import QPainter
    2. from PyQt5.QtPrintSupport import QPrinter
    3.  
    4. # Print options
    5. printer = QPrinter(QPrinter.HighResolution)
    6. printer.setOrientation(QPrinter.Portrait)
    7. printer.setPaperSize(QPrinter.A4)
    8. printer.setPageSize(QPrinter.A4)
    9. printer.setPageMargins(15, 15, 15, 15, QPrinter.Millimeter)
    10. printer.setFullPage(True)
    11. printer.setOutputFormat(QPrinter.PdfFormat)
    12. printer.setOutputFileName("testfile.pdf")
    13.  
    14. # Render/Paint it
    15. painter = QPainter()
    16. painter.begin(printer)
    17. MyWidget.render(painter)
    18. painter.end()
    To copy to clipboard, switch view to plain text mode 

    Assuming This documentation is accurate, the setFullpage on true should fix it. so what am I missing?
    Last edited by Saelyth; 11th August 2017 at 18:07.

Similar Threads

  1. Replies: 3
    Last Post: 26th August 2016, 15:40
  2. Works on 64bit doesn't on 32 bit
    By daniel_dm in forum Newbie
    Replies: 3
    Last Post: 5th August 2013, 13:24
  3. Replies: 3
    Last Post: 6th July 2011, 06:59
  4. Replies: 1
    Last Post: 31st December 2010, 16:35
  5. QPrinter setFullPage(): Win/Linux Diffs
    By ChrisW67 in forum Qt Programming
    Replies: 2
    Last Post: 9th October 2009, 05:31

Tags for this Thread

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.