Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved PDF file export

    Mobile and Embedded
    5
    7
    1425
    Loading More Posts
    • 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
      sashapont last edited by sashapont

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

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • S
          sashapont last edited by

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

          Alex 1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 0
            • ?
              A Former User last edited by

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

              1 Reply Last reply Reply Quote 0
              • T
                TEHb last edited by

                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 Reply Quote 0
                • Alex
                  Alex @sashapont last edited by

                  @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 Reply Quote 0
                  • First post
                    Last post