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

macOS: CUPS printer page size is wrong due to round

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.7, 5.15.1, 5.15.2, 6.0.0
    • Fix Version/s: None
    • Component/s: GUI: Printing
    • Labels:
      None
    • Environment:
      macOS Catalina and macOS Big Sur
    • Platform/s:
      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

            Assignee:
            vestbo Tor Arne Vestbø
            Reporter:
            jsilva Jorge Silva
            PM Owner:
            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