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. Combining Two PDF Files
Qt 6.11 is out! See what's new in the release blog

Combining Two PDF Files

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 2.4k Views
  • 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.
  • ManiRonM Offline
    ManiRonM Offline
    ManiRon
    wrote on last edited by
    #1

    Is there any way to combine two PDF file generated using QT?

    jsulmJ 1 Reply Last reply
    0
    • ManiRonM ManiRon

      Is there any way to combine two PDF file generated using QT?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @ManiRon How did you generate them?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ManiRonM Offline
        ManiRonM Offline
        ManiRon
        wrote on last edited by
        #3

        using Qprinter

        jsulmJ 1 Reply Last reply
        0
        • ManiRonM ManiRon

          using Qprinter

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ManiRon I don't think Qt provides anything for this.
          But can't you generate one PDF instead of generating two and then merging?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • ManiRonM Offline
            ManiRonM Offline
            ManiRon
            wrote on last edited by
            #5

            sorry. Ya but i am trying to add a header to the PDF using the HTML and then i want to print the text is there any way i can do this

            1 Reply Last reply
            0
            • ManiRonM Offline
              ManiRonM Offline
              ManiRon
              wrote on last edited by
              #6

              My HTML Code :

              <!DOCTYPE html>
              <html>
              <head>
              <style>
              .logo {
              width: 150px;
              height: 120px;

              }

              .logoHeader {
              height: 120px;
              vertical-align: middle;
              text-align: center;
              }

              .floatLeft { float: left; }

              .floatRight { float: right; }
              </style>
              </head>
              <body>

              <header>
              <img class="logo floatLeft" src="Logo.png" alt="Logo" />

              <img class="logo floatRight"  src="Data.gif" alt="Logo" />
              
              <h1 class="logoHeader">REPORT</h1>
              

              </header>

              </body>
              </html>

              1 Reply Last reply
              0
              • ManiRonM Offline
                ManiRonM Offline
                ManiRon
                wrote on last edited by
                #7

                This is my QT Code :
                QFile styleFile( "widget.qss" );
                styleFile.open( QFile::ReadOnly );
                QString hex = QString::fromLatin1( styleFile.readAll() );
                styleFile.close();
                QTextDocument document;
                QTextDocument document1;
                QString data = ui->teData->toPlainText();
                document.setHtml(hex.append(data));
                QPrinter printer;
                printer.setOutputFormat(QPrinter::PdfFormat);
                printer.setPaperSize(QPrinter::A4);
                printer.setOutputFileName("test.pdf");
                QPainter painter;
                painter.begin(&printer);
                painter.setBrush(Qt::transparent);
                painter.end();

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SebastienD
                  wrote on last edited by
                  #8

                  Hi,
                  To add header and footer I use the C library of https://wkhtmltopdf.org/

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    addisonfreya
                    wrote on last edited by
                    #9
                    This post is deleted!
                    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