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 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
    • XPlatformsX Offline
      XPlatformsX Offline
      XPlatforms
      wrote on 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
      3
      • XPlatformsX XPlatforms

        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 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.

        mrjjM 1 Reply Last reply
        0
        • M martonmiklos

          @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.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on 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 last edited by
            #5

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

            mrjjM 1 Reply Last reply
            0
            • M martonmiklos

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

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on 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

              • Login

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