Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. PDF file export
Qt 6.11 is out! See what's new in the release blog

PDF file export

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
7 Posts 5 Posters 3.0k Views 4 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.
  • S Offline
    S Offline
    sashapont
    wrote on last edited by sashapont
    #1

    How is possible to export to pdf file with QPdfWriter- QTextDocument document which many pages and devede on pages pdf?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Something like this:

      QPdfWriter pdfWriter(filePath);
      QPainter painter(&pdfWriter);
      textDocument->drawContents(&painter);
      

      should do the trick.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sashapont
        wrote on last edited by
        #3

        It is good decision, but I try to export long table and it is not fit in one page :(((( And many rows are cut...

        AlexA 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You should then maybe adapt the handling of the table to fit on pages to print.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            Hi! Maybe you want to use a report engine, e.g. @aliks-os's QtRPT?

            1 Reply Last reply
            0
            • T Offline
              T Offline
              TEHb
              wrote on last edited by
              #6

              Maybe try Lime Report ? Dev's support always online.

              Lime Report is multi-platform and fully supported report engine library, report generator, report designer, report writer, reporting tool and reporting solution written in C++ based on Qt cross-platform application and UI framework. Lime Report is the best choice if you are looking for a Qt report engine, Qt report tool, Qt report library, Qt reporting tool, C++ reporting library for Qt or a Qt reporting library or simply a printing tool that generates PDF document from Qt using an XML template.

              https://sourceforge.net/projects/limereport/

              https://github.com/fralx/LimeReport

              1 Reply Last reply
              0
              • S sashapont

                It is good decision, but I try to export long table and it is not fit in one page :(((( And many rows are cut...

                AlexA Offline
                AlexA Offline
                Alex
                wrote on last edited by
                #7

                @sashapont The best way is to use report generators.
                Consider CuteReport. It has pagination, item splitting, text flow, automatic table of contents and a lot of other handy features.
                It is provided under both GPL/LGPL and proprietary Enterprise version.
                Take a look:
                CuteReport
                SourceForge

                https://cute-report.com

                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
                • Unsolved