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. How can I used QPrinter with QPrinter::HighResolution to save png file

How can I used QPrinter with QPrinter::HighResolution to save png file

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 3.0k 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    How can I used QPrinter with QPrinter::HighResolution to save png file

    1 Reply Last reply
    0
    • artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #2

      Hi,
      more convenient way would be to use i.e. QImage::save() if you think png. QPrinter might be convenient when you wish for pdf.
      However to completely answer your question please refer to QPrinter documentation - you could print on QPainter and then use it together with QPicture or other format to save the data as png.

      For more information please re-read.

      Kind Regards,
      Artur

      Q 1 Reply Last reply
      1
      • artwawA artwaw

        Hi,
        more convenient way would be to use i.e. QImage::save() if you think png. QPrinter might be convenient when you wish for pdf.
        However to completely answer your question please refer to QPrinter documentation - you could print on QPainter and then use it together with QPicture or other format to save the data as png.

        Q Offline
        Q Offline
        Qt Enthusiast
        wrote on last edited by
        #3

        @artwaw

        Since I tried it did not work .could you write a sample code

        What does QPrinter::HighResolution does . how does it increases the levelOfDetail in QGraphicsView

        jsulmJ 1 Reply Last reply
        0
        • Q Qt Enthusiast

          @artwaw

          Since I tried it did not work .could you write a sample code

          What does QPrinter::HighResolution does . how does it increases the levelOfDetail in QGraphicsView

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

          @Qt-Enthusiast said in How can I used QPrinter with QPrinter::HighResolution to save png file:

          Since I tried it did not work

          What did you try? What did not work?

          QPrinter::HighResolution: http://doc.qt.io/qt-5/qprinter.html
          "On Windows, sets the printer resolution to that defined for the printer in use. For PDF printing, sets the resolution of the PDF driver to 1200 dpi."

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

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            Qt Enthusiast
            wrote on last edited by
            #5

            but I can save the image in png format with

            QPrinter printer(QPrinter::HighResolution);
            printer.setCreator(PRODUCT_NAME);
            printer.setOutputFileName(nm);
            QPainter painter(&printer);
            render(&painter);

            Please let me know what I am missing

            jsulmJ 1 Reply Last reply
            0
            • Q Qt Enthusiast

              but I can save the image in png format with

              QPrinter printer(QPrinter::HighResolution);
              printer.setCreator(PRODUCT_NAME);
              printer.setOutputFileName(nm);
              QPainter painter(&printer);
              render(&painter);

              Please let me know what I am missing

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

              @Qt-Enthusiast I'm lost now. It is really hard to understand your questions.
              Why do you try to save image using QPrinter?! Why don't you do it as @artwaw suggested?
              "Please let me know what I am missing" - you should store images like @artwaw suggested not via QPrinter...

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

              1 Reply Last reply
              1

              • Login

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