Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPrinter, PDF and margins ...
Qt 6.11 is out! See what's new in the release blog

QPrinter, PDF and margins ...

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • HoMaH Offline
    HoMaH Offline
    HoMa
    wrote on last edited by
    #1

    In my sample program https://github.com/Schachigel/QtLetter I found out, that using a printer in pdf mode creates different results with QPrintPreview then with a pdf file.
    Actually the file has additional margins added.

    I know that the print function of QTextDocuments docu talks about additional margins .. but I only use "drawContent" ...

    Any idea why this is the case?
    regards
    Holger

    K 1 Reply Last reply
    0
    • HoMaH HoMa

      Thx you for this comment.
      Are you aware of https://doc.qt.io/qt-5/qtpdf-module.html ?
      This is for reading pdf, not writing, right?
      Regards
      Holger

      K Offline
      K Offline
      koahnig
      wrote on last edited by koahnig
      #4

      @HoMa

      Sorry I did not read careful enough. Thought this would be included there https://doc.qt.io/qt-5/qpdfwriter.html

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      2
      • HoMaH HoMa

        In my sample program https://github.com/Schachigel/QtLetter I found out, that using a printer in pdf mode creates different results with QPrintPreview then with a pdf file.
        Actually the file has additional margins added.

        I know that the print function of QTextDocuments docu talks about additional margins .. but I only use "drawContent" ...

        Any idea why this is the case?
        regards
        Holger

        K Offline
        K Offline
        koahnig
        wrote on last edited by
        #2

        @HoMa

        The same as in https://forum.qt.io/topic/119833/font-size-in-qprinter/2

        Printing into a pdf is basically a printer driver.

        Are you aware of https://doc.qt.io/qt-5/qtpdf-module.html ?

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0
        • HoMaH Offline
          HoMaH Offline
          HoMa
          wrote on last edited by HoMa
          #3

          Thx you for this comment.
          Are you aware of https://doc.qt.io/qt-5/qtpdf-module.html ?
          This is for reading pdf, not writing, right?
          Regards
          Holger

          K 1 Reply Last reply
          0
          • HoMaH HoMa

            Thx you for this comment.
            Are you aware of https://doc.qt.io/qt-5/qtpdf-module.html ?
            This is for reading pdf, not writing, right?
            Regards
            Holger

            K Offline
            K Offline
            koahnig
            wrote on last edited by koahnig
            #4

            @HoMa

            Sorry I did not read careful enough. Thought this would be included there https://doc.qt.io/qt-5/qpdfwriter.html

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            2
            • HoMaH Offline
              HoMaH Offline
              HoMa
              wrote on last edited by
              #5

              @koahnig Thx! That is much better. The add. margins do not show up in a pdf created with QPdfWriter (everything else the same as with QPrinter in "PDF mode"). I will update my sample on GitHub - maybe others can benefit, too.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved