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

QPrinter setFullPage(true): Origin is not in the upper left corner of the paper on Windows.

XMLWordPrintable

      Previously logged and acknowledged as issue number #261362 in old system but never visible there or here.

      I use QPrinter::setFullPage() to allow me to place a full-page sized template of a complex form (from an SVG file) on the page. On Linux it works fine. On Windows the template image is offset because, apparently, full page does not mean that on Windows (except when the print is directed to PDF).

      This test code:

      #include <QtGui>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QPrinter p(QPrinter::HighResolution);
          p.setPaperSize(QPrinter::A4);
          p.setOrientation(QPrinter::Landscape);
          p.setFullPage(true);
          qDebug() << "Page rect:  " << p.pageRect();
          qDebug() << "Paper rect: " << p.paperRect();
      
          QWidget mainWin;
          mainWin.show();
          return app.exec();
      }
      

      On Linux prints equal page and paper rectangles as the docs imply:

      Page rect: QRect(0,0 14033x9917)
      Paper rect: QRect(0,0 14033x9917)

      and Windows with a 'real' printer selected:

      Page rect: QRect(99,99 6814x4760)
      Paper rect: QRect(0,0 7016x4961)

      The result is the template is properly placed over the entire page in Linux but is offset right and down on Windows. If the default Windows printer is set to a virtual printer (e.g. Distiller or XPS Writer) the behaviour is correct.

      Qt 4.5.2 on Linux. Qt 4.5.2 in Qt SDK 2009.03 on Windows

        For Gerrit Dashboard: QTBUG-5363
        # Subject Branch Project Status CR V

            johnlayt John Layt
            chrisw67 Chris Williams
            Votes:
            18 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes