QTextDocument (html) print problems
-
Hello,
I tried to print a html file via QTextDocument.
I use following code:
QTextDocument *doc = new QTextDocument(); doc->setHtml(htmlContent); doc->print(printer);
The result is not that what i expect.
See the attachment.https://drive.google.com/file/d/0ByPfRL92bgFrM1IxblQwNk56M28/view?usp=sharing
https://drive.google.com/file/d/0ByPfRL92bgFrVVJXbktmNFNLQVk/view?usp=sharing
-
Hello,
I tried to print a html file via QTextDocument.
I use following code:
QTextDocument *doc = new QTextDocument(); doc->setHtml(htmlContent); doc->print(printer);
The result is not that what i expect.
See the attachment.https://drive.google.com/file/d/0ByPfRL92bgFrM1IxblQwNk56M28/view?usp=sharing
https://drive.google.com/file/d/0ByPfRL92bgFrVVJXbktmNFNLQVk/view?usp=sharing
-
Super.
You should look at the doc on screen and see if same is shown.
If yes, it means that QTextDocument and you
do not agree how the HTML should be rendered :) -
Hi
But it only splits to other page if page is full?
It sounds like expected action. It will not reduce font size to
make it fit :) -
it splits the cell at the left ( Date ).
Expected result:
- change font size
- move last row to the next page
-
@mschmit
Sorry, no. Not really.
Only option is to tweak the html.
You can also render the widget to bitmap and control the size but that is not good quality.We are in different time zones here on forum
so give it a day.
There might be someone that have seens this and found something for it. :) -
@mschmit
Sorry, no. Not really.
Only option is to tweak the html.
You can also render the widget to bitmap and control the size but that is not good quality.We are in different time zones here on forum
so give it a day.
There might be someone that have seens this and found something for it. :)Oh btw
You can test with
doc.setPageSize(paperSize)
and maybe get other results. -
I tried to compile the tool with qt 5.7.
It looks better but the last row on the page is splitted onto 2 pages.
the css-prop word-break:keep-all does not work :-(https://drive.google.com/file/d/0ByPfRL92bgFrOUFkTS1mXzJLbHc/view?usp=sharing
-
I tried to compile the tool with qt 5.7.
It looks better but the last row on the page is splitted onto 2 pages.
the css-prop word-break:keep-all does not work :-(https://drive.google.com/file/d/0ByPfRL92bgFrOUFkTS1mXzJLbHc/view?usp=sharing
@mschmit
Does look better :)Only a subset is supported. QTextDocument is NOT a browser.
http://doc.qt.io/qt-5/richtext-html-subset.html -
I hava a solution :-)
the problem is the css attribute "vertical-align:middle"
i remove this entry and so i have my workaround.
But i think this is a bug. From my point of view splitted rows shoud change to "vertical-align:top"
https://drive.google.com/file/d/0ByPfRL92bgFrek0wbmJxME4ySXM/view?usp=sharing
-
I hava a solution :-)
the problem is the css attribute "vertical-align:middle"
i remove this entry and so i have my workaround.
But i think this is a bug. From my point of view splitted rows shoud change to "vertical-align:top"
https://drive.google.com/file/d/0ByPfRL92bgFrek0wbmJxME4ySXM/view?usp=sharing