Qt World Summit: Submit your Presentation

Font size in QPrinter

  • If I use drawContent to print QTextDocument into a QPrinter (or a QPrintPreview) I find, that the font size, which I set to 10pt in the html style, is apparently bigger than 10pt. I found no reason for this - do you have an idea?

    PS: You can see the effect with this sample code:

  • @HoMa

    This might depend on your OS.

    From QPrinter documentation:
    When printing directly to a printer on Windows or macOS, QPrinter uses the built-in printer drivers. On X11, QPrinter uses the Common Unix Printing System (CUPS) to send PDF output to the printer. As an alternative, the printProgram() function can be used to specify the command or utility to use instead of the system default.

    Therefore you need to check with other tools if you see the same effect. Probably you will.

Log in to reply