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. QT pdf
Qt 6.11 is out! See what's new in the release blog

QT pdf

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.1k Views 1 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.
  • G Offline
    G Offline
    ganeshgladish
    wrote on last edited by
    #1

    hi,

    i was create pdf from qt-c++....now i have gui in qml ...i want to send this gui to create as pdf ..

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Great idea. What's your question?

      1 Reply Last reply
      0
      • raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        try something like this:
        @
        QPrinter printer(QPrinter::HighResolution);
        printer.setOutputFormat(QPrinter::PdfFormat);
        printer.setOutputFileName(filename);
        QPrintDialog printDialog(&printer);
        if(printDialog.exec() == QDialog::Accepted)
        {
        mainWindow->render(&printer);
        }
        @

        or if you use Qt 5 you can use "QPdfWriter":http://qt-project.org/doc/qt-5.0/qtgui/qpdfwriter.html:
        @
        QPdfWriter pdfWriter("C:/mypdf.pdf");
        mainWindow->render(&pdfWriter);
        @

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • G Offline
          G Offline
          ganeshgladish
          wrote on last edited by
          #4

          thank you for your reply Andre,

          i have gui in qml...i want to print this gui as pdf....how to send this gui to this painter

          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