TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки
Python Заметки avatar

TGINSIGHT POST

Post #341

@pythonotes

Python Заметки

Views2,150Post view count
PostedSep 2009/20/2023, 09:03 AM
Post content

Post content

Как в Linux отправить картинку на печать из Python? Это можно сделать с помощью CUPS - Common Unix Printing System ▫️ Ставим зависимости sudo apt install -y libcups2-dev python3-dev gcc ▫️ Устанавливаекм библиотеку-обертку pip install pycups ▫️ Печатаем import cups # устанавливаем коннект conn = cups.Connection() # получаем список принтеров printers = conn.getPrinters() print(printers) printer_name = list(printers.keys())[0] # отправляем на печать conn.printFile(printer_name, image_path, "Image Print", {}) #libs