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. Embedding files to PDF with Qt
Forum Updated to NodeBB v4.3 + New Features

Embedding files to PDF with Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 2.3k 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.
  • M Offline
    M Offline
    martonmiklos
    wrote on 25 Oct 2016, 07:58 last edited by
    #1

    Hello all,

    I am looking for a preferably cross platform solution to embed an XML file to a PDF file.

    If you know a proper Qt solution to it please let me know!

    Thank you in advance!

    1 Reply Last reply
    0
    • X Offline
      X Offline
      XPlatforms
      wrote on 25 Oct 2016, 08:07 last edited by
      #2

      Which kind of XML is that?
      You would like to add XML to the existing PDF file or just create PDF from XML?
      If you want to just create PDF from XML you may open XML with QWebView and print it to PDF. Or open XML with Rich TextEdit and print it to PDF.

      M 1 Reply Last reply 25 Oct 2016, 11:56
      3
      • X XPlatforms
        25 Oct 2016, 08:07

        Which kind of XML is that?
        You would like to add XML to the existing PDF file or just create PDF from XML?
        If you want to just create PDF from XML you may open XML with QWebView and print it to PDF. Or open XML with Rich TextEdit and print it to PDF.

        M Offline
        M Offline
        martonmiklos
        wrote on 25 Oct 2016, 11:56 last edited by
        #3

        @XPlatforms
        PDF has a capability to embed files like attachments.

        Qt has a capability to create PDF files with the QPrinter.
        I would like to add an invoice in XML format to a PDF invoice.
        I know that this is currently not supported by the QPrinter itself, but I could accept a solution which could add attachments to existing PDF files.

        M 1 Reply Last reply 25 Oct 2016, 12:43
        0
        • M martonmiklos
          25 Oct 2016, 11:56

          @XPlatforms
          PDF has a capability to embed files like attachments.

          Qt has a capability to create PDF files with the QPrinter.
          I would like to add an invoice in XML format to a PDF invoice.
          I know that this is currently not supported by the QPrinter itself, but I could accept a solution which could add attachments to existing PDF files.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 25 Oct 2016, 12:43 last edited by
          #4

          @martonmiklos
          Hi
          pdftk
          https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
          can do it.

          pdftk html_tidy.pdf attach_files command_ref.html to_page 24 output html_tidy_book.pdf
          https://www.linux.com/learn/manipulating-pdfs-pdf-toolkit

          You can call it with QProcess and it should work nice.

          1 Reply Last reply
          3
          • M Offline
            M Offline
            martonmiklos
            wrote on 25 Oct 2016, 17:57 last edited by
            #5

            @mrjj
            Many thanks for this hint, pdftk seems to be able to deal what I am planning to do!

            M 1 Reply Last reply 25 Oct 2016, 17:58
            0
            • M martonmiklos
              25 Oct 2016, 17:57

              @mrjj
              Many thanks for this hint, pdftk seems to be able to deal what I am planning to do!

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 25 Oct 2016, 17:58 last edited by mrjj
              #6

              @martonmiklos
              well i used it to split pdf at random pages, add new pages and other info and then collect it again.
              I was very pleased with its stability and performance. (free version)

              1 Reply Last reply
              0

              1/6

              25 Oct 2016, 07:58

              • Login

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