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. QPdfwriter: how to switch to a new page when first page is completed?
Forum Updated to NodeBB v4.3 + New Features

QPdfwriter: how to switch to a new page when first page is completed?

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 3.2k 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.
  • alsaA Offline
    alsaA Offline
    alsa
    wrote on last edited by
    #1

    Title is clear as question: starting from a txt file longer than a single page, I'd like to complete my file in a second page when first is done.
    How can I use NewPage() in order to understand when first page is completed?

    artwawA 1 Reply Last reply
    0
    • alsaA alsa

      Title is clear as question: starting from a txt file longer than a single page, I'd like to complete my file in a second page when first is done.
      How can I use NewPage() in order to understand when first page is completed?

      artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #2

      @alsa From docs:
      "The newPage() method can be used to create several pages."

      http://doc.qt.io/qt-5/qpdfwriter.html#details

      So, after you reach end of page you call the method to initiate next page.

      For more information please re-read.

      Kind Regards,
      Artur

      alsaA 1 Reply Last reply
      1
      • artwawA artwaw

        @alsa From docs:
        "The newPage() method can be used to create several pages."

        http://doc.qt.io/qt-5/qpdfwriter.html#details

        So, after you reach end of page you call the method to initiate next page.

        alsaA Offline
        alsaA Offline
        alsa
        wrote on last edited by
        #3

        @artwaw said in QPdfwriter: how to switch to a new page when first page is completed?:

        @alsa From docs:
        "The newPage() method can be used to create several pages."

        http://doc.qt.io/qt-5/qpdfwriter.html#details

        So, after you reach end of page you call the method to initiate next page.

        How can I know when end of page has been reached?

        artwawA 1 Reply Last reply
        0
        • alsaA alsa

          @artwaw said in QPdfwriter: how to switch to a new page when first page is completed?:

          @alsa From docs:
          "The newPage() method can be used to create several pages."

          http://doc.qt.io/qt-5/qpdfwriter.html#details

          So, after you reach end of page you call the method to initiate next page.

          How can I know when end of page has been reached?

          artwawA Offline
          artwawA Offline
          artwaw
          wrote on last edited by
          #4

          @alsa That is more complicated and depends on for example on the font metrics etc. What exactly would you like to print? Simple text, rich text? Can you please post some of the code that's responsible for printing the data?

          For more information please re-read.

          Kind Regards,
          Artur

          alsaA 1 Reply Last reply
          1
          • artwawA artwaw

            @alsa That is more complicated and depends on for example on the font metrics etc. What exactly would you like to print? Simple text, rich text? Can you please post some of the code that's responsible for printing the data?

            alsaA Offline
            alsaA Offline
            alsa
            wrote on last edited by
            #5

            @artwaw try to send you my text file, but a message from this Fourm tells me I don't have privileges enough to enclosed file. How can I do?

            artwawA 1 Reply Last reply
            0
            • alsaA alsa

              @artwaw try to send you my text file, but a message from this Fourm tells me I don't have privileges enough to enclosed file. How can I do?

              artwawA Offline
              artwawA Offline
              artwaw
              wrote on last edited by
              #6

              @alsa Post it in the post in here, wrap the source code in triple ` at the beginning and another triple at the end of the code block.

              For more information please re-read.

              Kind Regards,
              Artur

              1 Reply Last reply
              0
              • alsaA Offline
                alsaA Offline
                alsa
                wrote on last edited by
                #7
                Model: TS400 - Serial/n: 500S_06_17
                Date: 09:48:57  31/05/17
                Temp: 25°C - Humidity: 55% 
                checked by: AM - Fluke s/n: 1971
                 01	100	MONOPOLAR_CUT	PURE_CUT	400	323.3	NONE	243	364	PASSED
                 02	350	MONOPOLAR_CUT	PURE_CUT	400	381.5	NONE	312	400	PASSED
                 03	1500	MONOPOLAR_CUT	PURE_CUT	400	215.5	NONE	178	267	PASSED
                 04	100	MONOPOLAR_CUT	PURE_CUT	200	214.3	NONE	148	223	PASSED
                 05	350	MONOPOLAR_CUT	PURE_CUT	200	215.7	NONE	160	240	PASSED
                

                This is a small sample; text file is composed by 100 lines. It's a report of power delivery by an electrosurgical unit. Lines starts with step number and ends with PASSED or FAILED.

                artwawA 1 Reply Last reply
                0
                • alsaA alsa
                  Model: TS400 - Serial/n: 500S_06_17
                  Date: 09:48:57  31/05/17
                  Temp: 25°C - Humidity: 55% 
                  checked by: AM - Fluke s/n: 1971
                   01	100	MONOPOLAR_CUT	PURE_CUT	400	323.3	NONE	243	364	PASSED
                   02	350	MONOPOLAR_CUT	PURE_CUT	400	381.5	NONE	312	400	PASSED
                   03	1500	MONOPOLAR_CUT	PURE_CUT	400	215.5	NONE	178	267	PASSED
                   04	100	MONOPOLAR_CUT	PURE_CUT	200	214.3	NONE	148	223	PASSED
                   05	350	MONOPOLAR_CUT	PURE_CUT	200	215.7	NONE	160	240	PASSED
                  

                  This is a small sample; text file is composed by 100 lines. It's a report of power delivery by an electrosurgical unit. Lines starts with step number and ends with PASSED or FAILED.

                  artwawA Offline
                  artwawA Offline
                  artwaw
                  wrote on last edited by
                  #8

                  @alsa My solution would be to use QTextDocument - gather complete output, insert it to QTextDocument, set desired font etc. in the QTextDocument and use its built in method print(). This way you do not have to worry about pagination or anything else.
                  Please read about QTextDocument and associated classes - everything you need is there at hand.
                  Should you have any additional queries I would be happy to help.

                  For more information please re-read.

                  Kind Regards,
                  Artur

                  1 Reply Last reply
                  1
                  • alsaA Offline
                    alsaA Offline
                    alsa
                    wrote on last edited by
                    #9

                    ok, I'll follow your advise; after I'll give you an answer about my trial.
                    Thanks artwaw

                    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