Important: Please read the Qt Code of Conduct -

QPrintPreviewDialog doesn't display html doc correctly

  • Hi,

    I want to print some info from HTML table but the info doesn't display correctly in print preview dialog. The headers don't display in one line, I tried to chage the size property many times buts still. And there are missing letters, Jill displays only J l and Smith displays as Sm th.

    Here is an snapshot of the print preview dialog:

    and the HTML code is:

    doc = "<!DOCTYPE html>"
    "<font size=\"72\">"
                "<table style=\"width:100%\">"

    I also tried addig

                "table, th, td {"
                "th, td {"
                    "padding: 5px;"
                "th {"
                    "text-align: left;"

    I got only 3 letters per page.

        QTextDocument  *document = new QTextDocument ;

Log in to reply