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

macOS: CUPS printer page size is wrong due to round

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.7, 5.15.1, 5.15.2, 6.0.0
    • GUI: Printing
    • None
    • macOS Catalina and macOS Big Sur
    • macOS

    Description

      On macOS, the PageSize reported by a printer via CUPS is not accurate due to a qRound used in the code.

      I have a card printer that supports only the paper size CR80 (54.86 x 86.02mm). This is the size mentioned by the manufacturer and the size seen in CUPS web page.
      In the printer PPD file, the page size is correctly being defined as 155.52 243.84 (in points).
      Being a point 1/72 of an inch, we can check that:

      • The expected page size height is: 155.52 * (1/72) * 25.4 = 54.86 mm
      • The expected page size width is: 243.84 * (1/72) * 25.4 = 86.02 mm

      However, the reported size in QPageSize is 54,68mm x 85,73mm.
      When printing at 300 DPIs, the final image size sent to the printer has less pixels then expected.

      I've isolated the problem to qRound being used when values are read from PPD file:

      qtbase\src\plugins\printsupport\cups\qppdprintdevice.cpp (line 156/180 on Qt 5.15 branch and line 160/184 on Qt 6 branch)

      QSize size = QSize(qRound(ppdSize->width), qRound(ppdSize->length));
      

      Instead of a QSize, it will be necessary to use a QSizeF.

      I can help with the fix, if necessary.

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            jsilva Jorge Silva
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes