PDA

View Full Version : Disappearing html table border when viewing pdf file prepared using QTextDocument



Kdev
15th September 2015, 22:22
Hello @all,

I need to draw and print simple table to the PDF file. I'm using QTextDocument and html/css tags to draw nice table with 1px border on QPainter. When I'm viewing created PDF file in PDF viewer, borders of this table dissapear when zooming in/out the document. When I zoom in to the max I see all 1px borders of this table but when I zoom out again some borders dissapear. I thought that it's some kind of optimization of PDF viewer but the strange thing is that 1px lines/borders drawn using QPainter::drawLine() and printed in the same PDF file look good and don't disappear. So it looks to me like a problem of QTextDocument, but I'm not sure and would like to ask you for help. Thanks in advance!

* I tried other PDF viewers too, both Windows and Linux and the same thing happened.
* I tried to search through the forum to find similar cases but the answers I found didn't help me a lat (I cannot use Webkit etc).
* I'm aware of the limitations mentioned here (http://doc.qt.io/qt-5/richtext-html-subset.html) and I use only the supported subset of html/css tags.

Netgaf
8th October 2015, 11:11
Hi,

try to draw QTextDocument on QImage and then draw this image on your QPrinter, this should solve your issue :D