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!
Tran Hoang Son is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.