如何在Python中将作业发送到网络打印机

2024-05-23 17:51:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我可以用Python将文件/作业发送到网络打印机的所有方法。 我尝试了以下代码,但它仅用于发送文本,但我想将pdf/文件发送到打印机

    from escpos.connections import getNetworkPrinter    
    printer = getNetworkPrinter()(host='192.168.0.20', port=9100)

    printer.text("Hello World")
    printer.lf()

Tags: 文件方法代码from文本import网络host