Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Printing html QTextDocument prints images wrong...



  • Hello all,
    I have a small but nagging problem with Qt running on Linux Mint. I have a simple HTML QTextDocument that I want to print out using QPrinter. The document looks much like this:
    @<p>Text block 1</p>
    <p>Text block 2</p>
    .
    .
    .
    <p><img src="/path/to/file.png" /></p>@

    Now, the text blocks are printed as expected, but the image is blown up to about three times its size in both vertical and horizontal direction. I have tried about a dozen ways of adding more or less explicit height and width parameters (as pixels, percentages, millmetres, with height & width attributes or in a style attribute) to no avail, the image looks always exactly the same.

    Can somebody tell me how I must include an image reference into a html QTextDocument in order to get the system to print it properly and not magnified that way?

    Thanks in advance, Pit.


Log in to reply