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. QPrinterDialog don't give the good paper size

QPrinterDialog don't give the good paper size

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.5k 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.
  • P Offline
    P Offline
    profecie
    wrote on last edited by
    #1

    hello everybody,

    I have a big problem ;)!!Yan can maybe help me.

    I have two printer
    -BROTHER 21cm29.7cm
    -Dymo(sticker printer) :3,2cm
    5,7cm

    when i call QPrintDialog and select the printer I want.The printer nam of the current printer changed but not the pageRect ,pageSize...and continue to give me the size of default printer.

    Exemple

    @void MainWindow::openprinterconfig()
    {

       QPrintDialog *dialog = new QPrintDialog(myprinter);
    
       dialog->exec() ;
       qDebug("%f", myprinter->paperRect(QPrinter::Millimeter).height());
       qDebug("%f", myprinter->paperRect(QPrinter::Millimeter).width());
       qDebug(myprinter->printerName().toLocal8Bit());
    

    }@

    case 1:Dymo is default printer and i try to select BROTHER printer
    31.750000
    57.150000
    Brother HL-2140

    case 2:BROTHER is default printer and i try to select Dymo printer
    297.000000
    210.000000
    DYMO LabelWriter 450

    If i try to print the selected printer in Qdialog work but I have to get the papersize in my application.

    Couold you help me Please?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Pretty strange indeed. What version of Qt/OS are you running ? What compiler are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        profecie
        wrote on last edited by
        #3

        I use qt on Windows 7 64 bits with QT Crator 3.2.0 and QT 5.3.1
        I use the compiler mingw 4.82

        1 Reply Last reply
        0
        • P Offline
          P Offline
          profecie
          wrote on last edited by
          #4

          and thanks for your answers

          1 Reply Last reply
          0
          • hskoglundH Online
            hskoglundH Online
            hskoglund
            wrote on last edited by
            #5

            Hi, just guessing but try calling myprinter->setFullPage(true); just before the paperRect() calls.

            1 Reply Last reply
            0
            • P Offline
              P Offline
              profecie
              wrote on last edited by
              #6

              Unfortunately the problem continue,

              with this code
              QPrintDialog *dialog = new QPrintDialog(this);
              @ if(dialog->exec() ==QDialog::Accepted)

                 {
                      QPrinter* printer3 = dialog->printer()  ;
                      qDebug(dialog->printer()->printerName().toLocal8Bit());
                      printer3->setFullPage(true);
                      qDebug("%f", printer3->pageRect(QPrinter::Millimeter).height());
                      qDebug("%f", printer3->pageRect(QPrinter::Millimeter).width());
                  }@
              

              QT return:

              if the BROTHER is the default printer:
              DYMO LabelWriter 450
              297.000000
              210.000000

              if the DYMO is the default printer:
              DYMO LabelWriter 450
              31.750000
              57.150000

              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