Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Issue with PySide6 and Oki-Microline-8480 Printer

Issue with PySide6 and Oki-Microline-8480 Printer

Scheduled Pinned Locked Moved Unsolved Qt for Python
pysideqt for python
8 Posts 3 Posters 679 Views
  • 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.
  • S Offline
    S Offline
    sontrantls
    wrote on last edited by
    #1

    I am using PySide6 version 6.5.2 to interface with an impact printer model, specifically the Oki-Microline-8480. My goal is to print a value at a specific coordinate with a Y-coordinate of 27 inches, but I'm encountering difficulties achieving this.

    To customize the printable area size, I have attempted to use the following code snippet:

    from PySide6.QtCore import QSizeF
    from PySide6.QtGui import  QPageSize
    from PySide6.QtPrintSupport import QPrinter
    
    # assuming this code connect the printer to the Oki-Microline-8480 impact printer
    printer = QPrinter()
    
    # set custom page size for printer
    size_object = QSizeF()
    
    # setting height as 21 inch will succesfully set printer height to 21 inches
    # buf If I try 21.1 inch, the printer size will be at A4 page size
    size_object.setHeight(21.00)
    size_object.setWidth(16.01)
    custom_page_size = QPageSize(size_object, QPageSize.Unit.Inch, "CUSTOM", QPageSize.SizeMatchPolicy.FuzzyMatch)
    printer.setPageSize(custom_page_size)
    # set full page to make the printable area as big as possible
    printer.setFullPage(True)
    # print out printer height and width to test printable area
    print(f"{printer.width()=} and {printer.height()=}")
    

    However, I've observed that the maximum height I can set is 21 inches. When attempting to set the height beyond this value, the printer reverts to the default paper size height (A4 size, which is approximately 11.69 inches).

    If anyone has experience working with PySide6 and the Oki-Microline-8480 printer model or similar devices, I would greatly appreciate any advice or solutions on how to print at a Y-coordinate of 27 inches using this library and printer combination. Thank you!

    I also posted this concern in Stackoverflow https://stackoverflow.com/questions/78400213/issue-with-pyside6-and-oki-microline-8480-printer

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

      Hi and welcome to devnet,

      On which OS are you ?

      I just tested your code on macOS with PySide6 6.7.0 (QCoreApplication is missing by the way) and got printer.width()=1601 and printer.height()=2100.

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

      S 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        On which OS are you ?

        I just tested your code on macOS with PySide6 6.7.0 (QCoreApplication is missing by the way) and got printer.width()=1601 and printer.height()=2100.

        S Offline
        S Offline
        sontrantls
        wrote on last edited by sontrantls
        #3

        @SGaist thanks for replying. I used Window 10. I believe Printer.width and height value are measured in points, we can calculate height in point from inch using this formula : Printer height = height in inch * printer logical DPIY

        In my case, my logical DPIY is 144, and the maximum height in inch I can set is 21 inch => So my maximum value from printer.height is 3024

        Similar to the width, I figure out the maximum width is 16 inch => maximum printer width from printer.width() is 2304

        In my case, I want to reach the height of 27 inch => my printer.height() value should be 27 * 144 ( my logical DPIY ) = 3888

        SGaistS 1 Reply Last reply
        0
        • S sontrantls

          @SGaist thanks for replying. I used Window 10. I believe Printer.width and height value are measured in points, we can calculate height in point from inch using this formula : Printer height = height in inch * printer logical DPIY

          In my case, my logical DPIY is 144, and the maximum height in inch I can set is 21 inch => So my maximum value from printer.height is 3024

          Similar to the width, I figure out the maximum width is 16 inch => maximum printer width from printer.width() is 2304

          In my case, I want to reach the height of 27 inch => my printer.height() value should be 27 * 144 ( my logical DPIY ) = 3888

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @sontrantls Can you achieve that when printing from another application ?

          Are there settings for that printer that might control these values ?

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

          S 1 Reply Last reply
          0
          • SGaistS SGaist

            @sontrantls Can you achieve that when printing from another application ?

            Are there settings for that printer that might control these values ?

            S Offline
            S Offline
            sontrantls
            wrote on last edited by
            #5

            @SGaist Based on information from individuals familiar with this printer, they are able to utilize an IBM tool to print at a specific coordinate with Y = 24 inches. Therefore, I believe this capability is not limited by the printer itself.

            SGaistS 1 Reply Last reply
            0
            • S sontrantls

              @SGaist Based on information from individuals familiar with this printer, they are able to utilize an IBM tool to print at a specific coordinate with Y = 24 inches. Therefore, I believe this capability is not limited by the printer itself.

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @sontrantls that's the trick: does the utility do something at a lower level to communicate with this printer ?

              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
              • S Offline
                S Offline
                sontrantls
                wrote on last edited by
                #7

                that's part I'm not sure as I cannot access their source code .., but it might be the case

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  HibariX
                  wrote on last edited by
                  #8

                  Problem Description:

                  There is an issue with the setPageSize method of QPrinter in certain versions of PySide6, PyQt6, and some versions of PyQt5.
                  Solution:

                  The setPageSize method works properly in the PyQt 5.13.0 version.
                  Recommendation:

                  If possible,downgrade to PyQt 5.13.0 version, or look for specific fixes regarding the setPageSize issue.

                  bug i have not solution in PySide6 version, I need solution too!!!!!

                  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