Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    QT pdf

    General and Desktop
    3
    4
    1698
    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.
    • G
      ganeshgladish last edited by

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

        Great idea. What's your question?

        1 Reply Last reply Reply Quote 0
        • raven-worx
          raven-worx Moderators last edited by

          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 Reply Quote 0
          • G
            ganeshgladish last edited by

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