使用树莓派连接打印机,将打印机变成网络打印机

打开https://192.168.31.99:631/admin/

选择添加打印机,然后添加你的打印机

设置打印机信息

不用勾选“分享此打印机”

这里需要一个打印机驱动相关的PPD file,默认列表里没有lenovo

Get a PPD File From the Manufacturer

The printer configuration tool also allows you to provide a PPD file directly. Some manufacturers provide these files for their printers. You may find them on the printer’s driver disc, on the manufacturer’s download site for that printer, or included in the Windows driver itself if the printer is a PostScript printer.

Look around the manufacturer’s website or on the driver disc for the PPD file. You can also consider downloading the Windows driver and attempt to open it in a file-extraction program. Yes, even if it’s an .exe file, you may be able to open it up and dig around to see if you can find a PPD file. This may requier the cabextract tool.

You could also consider performing a web search for the name of the printer and “PPD file” to see if other people have successfully located a PPD file that will work for the printer. If you have a PPD file, you can install it from the printer configuration interface.

                                                           —— https://www.howtogeek.com/215235/how-to-install-printer-drivers-on-linux/

卡在了ppd文件这一项,

 

未完待续

 

参考:

Wikipedia - ppd file: https://en.wikipedia.org/wiki/PostScript_Printer_Description

sspai-树莓派添加打印机:https://sspai.com/post/40997

树莓派用cups添加打印机:https://www.howtogeek.com/169679/how-to-add-a-printer-to-your-raspberry-pi-or-other-linux-computer/

cups使用指南:http://distro.ibiblio.org/smeserver/contribs/rvandenaker/testing/smeserver-cups/documentation/howtos/cups-add-printer.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
树莓派上控制打印机打印文本需要先安装打印机驱动和Python打印模块,在此以EPSON TM-T88V打印机为例,介绍如何在树莓派上编写Python程序控制打印机打印文本。 1. 安装打印机驱动 在树莓派上安装打印机驱动需要先连接打印机,然后使用以下命令安装驱动: ``` sudo apt-get update sudo apt-get install printer-driver-escpr ``` 2. 安装Python打印模块 安装Python打印模块pycups,使用以下命令安装: ``` sudo apt-get install libcups2-dev sudo pip install pycups ``` 3. 编写Python程序 下面是一个简单的Python程序,可以控制EPSON TM-T88V打印机打印文本: ```python import cups # 连接打印机 conn = cups.Connection() printer_name = conn.getPrinters()[0] # 打印文本 text = "Hello, World!" job_id = conn.printFile(printer_name, text, "Test Print", {}) ``` 这段代码使用pycups模块来与打印机进行交互。首先,我们使用`cups.Connection()`函数连接打印机。然后,我们使用`conn.getPrinters()`函数获取打印机列表,并选择列表中的第一个打印机作为目标打印机。最后,我们使用`conn.printFile()`函数将文本内容写入打印缓冲区并发送到打印机打印。函数的第一个参数为打印机名称,第二个参数为文本内容,第三个参数为打印任务名称,第四个参数为打印选项(可以为空字典)。 需要注意的是,在Linux系统上打印机名称可能会有所不同,可以使用`lpstat -p`命令查看系统中可用的打印机名称。另外,在使用pycups模块时需要使用root权限运行程序,或者将当前用户添加到lpadmin组中。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值