0
我有一個熱敏打印機,我很想在收據上打印一個標誌...是否有像shutil.copyfile這樣的PNG圖像?Python發送PNG文件到默認打印機
我的代碼如下
locations = ['/dev/usb/lp0', '/dev/usb/lp1', '/dev/usb/lp2']
size = locations.__len__()
i = 0
while i < size:
printer = locations[i]
try:
shutil.copyfile('output.txt', printer)
break
except IOError:
i += 1
if i == size:
logging.error('Unable to connect to the printer')
'size = len(locations)'..我們使用reportlab(https://bitbucket.org/rptlab/reportlab)來查看打印機的任何內容,但這比現在要複雜得多。 。 – thebjorn
謝謝你的信息。我仍在嘗試不同的設置,但我一定會看看剛剛提到的那個。 – Soichiro
也許這有幫助..? https://forums.anandtech.com/threads/command-line-image-printing-in-linux.739845/ – thebjorn