Results 1 to 1 of 1

Thread: Problem With Printing QWebView In PyQt

  1. #1
    Join Date
    Oct 2015
    Qt products
    Qt4 Qt5

    Default Problem With Printing QWebView In PyQt

    hi friends.

    i have a QWebView that renders my html fine. when i print it on a pdf printer or save it as pdf in pyqt it looks fine. but when i print it on real printer or print it as xps document i got unexpected results. fonts (arial) do not render correctly and some texts are overlapped and printed on a wrong offset.

    this is my code :
    Qt Code:
    1. printer = QtGui.QPrinter( QtGui.QPrinter.HighResolution )
    2. printer.setFontEmbeddingEnabled(True)
    3. printer.setOrientation(QtGui.QPrinter.Landscape)
    4. printer.setPageMargins(2, 2, 2, 2, QtGui.QPrinter.Millimeter)
    5. printer.setFullPage(True)
    6. printer.setPaperSize(QtGui.QPrinter.A4)
    7. dialog = QtGui.QPrintDialog(printer)
    8. dialog.setModal(True)
    9. dialog.setWindowTitle("Print")
    10. if dialog.exec_() == QtGui.QDialog.Accepted:
    11. self.web_view.print_(dialog.printer())
    To copy to clipboard, switch view to plain text mode 

    i am using PyQt 4.11.4 on windows 7 x64
    how can i fix this? is there any alternative way?
    Last edited by Santa.fat; 18th November 2015 at 22:12.

Similar Threads

  1. Printing from QWebView
    By folibis in forum Qt Programming
    Replies: 1
    Last Post: 4th December 2013, 03:37
  2. problem printing html with Qprinter and Qwebview
    By advseo32 in forum Qt Programming
    Replies: 3
    Last Post: 1st October 2013, 21:12
  3. Replies: 0
    Last Post: 29th April 2013, 11:47
  4. QWebView printing issue
    By blackhawk in forum Qt Programming
    Replies: 1
    Last Post: 24th April 2013, 08:03
  5. Printing with QWebView
    By Vnuce in forum Qt Programming
    Replies: 0
    Last Post: 7th April 2010, 12:59

Tags for this Thread


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.