英文:
How to send a job to a network printer in Python
问题
如何在Python中将文件/作业发送到网络打印机。
我尝试了以下代码,但这仅用于发送文本,但我想要发送PDF/文件到打印机。
from escpos.connections import getNetworkPrinter
printer = getNetworkPrinter()(host='192.168.0.20', port=9100)
printer.text("Hello World")
printer.lf()
英文:
all How i can send file/job to a network printer in Python.
I tried the following code but this is used to send only the text, but i want to send pdf/file to the printer.
from escpos.connections import getNetworkPrinter
printer = getNetworkPrinter()(host='192.168.0.20', port=9100)
printer.text("Hello World")
printer.lf()
答案1
得分: 1
我相信你无法打印PDF,但可以打印图像。将你的PDF转换为图像,然后打印。请参阅escpos文档和pdf2image。
英文:
I believe you can’t print pdf but images. Convert your pdf to image and print that.
See the docs for escpos and pdf2image
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论