Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84197

Printout cut from left on mac

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.14.2
    • GUI: Printing
    • None
    • macOS 10.15 with latest updates.
    • macOS

    Description

      Good afternoon,
      I am struggling to identify issue with printing. It appears on mac only.

      Task:

      • content is rendered to the image of the specified size (taken from printer settings)
      • content is written as pdf using QPdfWriter
      • content is sent to printer

      Code (boilerplate template really, minimum working example):

      {{// "rendered" is a vector of QImage}}
      {{ // "pSize" is QPageSize with a proper page size for selected printer}}
      {{ // "keys" is QStringList with the document list}}
      {{ // "render" is helper method that fills in the "rendered" vector as I use different backends for mac and windows}}
      QPrinter *printer = new QPrinter(QPrinterInfo::printerInfo(ui->printerCombo->currentText()),QPrinter::HighResolution);
      printer->setPageSize(pSize);
      ui->portraitBox->isChecked() ? printer->setOrientation(QPrinter::Portrait) : printer->setOrientation(QPrinter::Landscape);
      printer->setFullPage(true);
      QRect r;
      r = printer->pageRect(QPrinter::DevicePixel).toRect();
      for (auto x=0;x<keys.size();++x) {
         if (keys.at.endsWith(".pdf")) {
            rendered.append(render(pending.value(keys.at),r.height(),r.width()));
         }
      }
      painter.begin(printer);
      for (auto x=0;x<rendered.size();++x) {
         painter.drawImage(r,rendered.at.scaled(r.width(),r.height(),Qt::KeepAspectRatio,Qt::SmoothTransformation));
      {{    // that scale is not necessary above, it is leftover after some experiments to try to find out the solution}}
      {{   if (x<rendered.size()1) { printer>newPage(); }}}

      }
      painter.end();
      delete printer;

      Problem:
      On mac left side of the printout is cut slightly, about 2mm, half a width of a capital letter P.
      On windows works flawlessly.
      Moreover, on both platforms saving content with QPdfWriter produces perfectly valid pdf files, so rendering process works without issue.
      Just the printing...

      Can anyone recommend or comment on this please?

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            johnlayt John Layt
            artwaw Artur Wawrowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes