[PyQt] Printing from QWebView (contents visible) gives a set of blank pages

Hans-Peter Jansen hpj at urpla.net
Mon Aug 22 00:16:28 BST 2011


On Sunday 21 August 2011, 19:52:41 ivanko.rus wrote:
> Good afternoon! Recently I was trying to print a Web page from
> QWebView and ran into a pretty weird problem. It is the following: I
> can print my QWebView perfectly when setting the QPrinter's output
> format to PDF or PostScript. But when I try to print to a normal
> printer, however, it gives me the correct number of pages, only that
> the pages are all blank. I tried to do this with a virtual PDF
> printer in Windows, a normal printer (it had ink, btw =), tried to
> choose the "print to file" option on Windows, and the results were
> all the same. The other thing that puzzles me even more is that if I
> replace the QWebView with a QTextEdit, everything works perfectly
> with all kinds of printers. So I hope that someone can give me a
> little help, I would appreciate it very much. Thank you!

You missed to tell us something about your versions.

Works here with:
python: 2.6.2
sip: 4.12.4
qt4: 4.7.1
pyqt4: 4.8.5
os: Linux

Note, that printing is implemented quite differently in Windows and 
Linux, and QWebView is somewhat complex in itself.. It might be a 
printer _driver_ problem, which aren't that uncommon with Windows (but 
who cares: it's the industrial standard by definition).

Pete


More information about the PyQt mailing list