macOS - 打印机

版权声明:本文为博主原创文章,转载请附上本文链接地址。from : https://blog.csdn.net/lovechris00 https://blog.csdn.net/lovechris00/article/details/89099032

Mac 打印机


一、相关术语


1、PPD

PPD:PostScript Printer Description ,PostScript打印机描述。

PPD是一个文本文件,它包含了有关一个特定的打印机的特征和性能的描述,因此它包含如下信息:

  • 支持的纸张大小
  • 可打印区域
  • 纸盒的数目和名称
  • 可选特性,例如附加的纸盒或双面打印单元等
  • 字体
  • 分辨率

打印机驱动程序 解析 PPD文件 来发现这台打印机的可用性能。打印机驱动程序根据这个信息来确立用户界面,另外,PPD文件还包含了使用这些性能所需的PostScript命令,当用户通过驱动程序的用户界面选择一个功能时,例如双面打印或水印打印,就会从PPD文件中提取适用该功能的 PostScript 代码并将其添加到要发送到打印机的PostScript文件中去,这样就可以实现你所选择的打印功能了。


2、PostScript打印机

使用 PostScript 页面描述语言 (PDL) 在输出媒体(例如,纸张或透明胶片)上创建文本和图形。

PostScript 打印机的范例包括 Apple LaserWriter、NEC LC-890 和 QMS PS-810。

可以在 /Library/Printers/PPDs/Contents/Resources 中看到打印机的 ppd 文件,双击文件会解压到下载文件夹。


二、GUI 查看

偏好与设置面板 —> 打印机与扫描仪

在配置面板点击减号按钮删除打印,并不会删除/卸载驱动。只会删除打印队列。

当创建打印队列时,这个打印机的PPD 文件也会被创建,这个PPD 文件会在删除队列的时候被删掉。


三、相关配置文件

驱动及信息: /Library/Printers , ~/Library/Printers

相关文件:/Library/Printers/InstalledPrinters.plist

文件内容说明:

  • InstalledPrinters - 安装的打印机;
  • Manufacturers:打印机厂商
  • MODEL:型号
<dict>
	<key>InstalledPrinters</key>
	<array>
		<string>MANUFACTURER:1235;MODEL:44271</string>
		<string>MANUFACTURER:3268;MODEL:4166</string>
		<string>MANUFACTURER:Fujitsu;MODEL:Fujitsu Keyboard</string>
		<string>MANUFACTURER:Logitech;MODEL:USB Optical Mouse</string>
	</array>
	<key>Manufacturers</key>
	<array>
		<string>1133</string>
		<string>3064</string>
		<string>Fujitsu</string>
		<string>Logitech</string>
	</array>
</dict>
</plist>


注意:

在上面这份数据中,Logitech 是我的鼠标,也被计入到打印机设备表中。但在打印机与扫描仪的偏好设置面板中,没有 Logitech 这个数据。

新添加的 PDF 打印机,不一定会出现在这份列表中。


四、相关命令

  • lpinfo 打印机信息
  • lpadmin
  • lpoptions
  • lp 打印
  • lpq
  • lpr
  • lprm
  • lpstat

1、lpinfo 获取打印机信息

drv : driver

$ lpinfo -m
drv:///sample.drv/dymo.ppd Dymo Label Printer
drv:///sample.drv/epson9.ppd Epson 9-Pin Series
drv:///sample.drv/epson24.ppd Epson 24-Pin Series
Library/Printers/PPDs/Contents/Resources/EPSON FAX.gz EPSON FAX
Library/Printers/PPDs/Contents/Resources/EPSON FAX A3.gz EPSON FAX A3
drv:///sample.drv/generpcl.ppd Generic PCL Laser Printer
drv:///sample.drv/generic.ppd Generic PostScript Printer
drv:///sample.drv/deskjet.ppd HP DeskJet Series
drv:///sample.drv/laserjet.ppd HP LaserJet Series PCL 4/5
drv:///sample.drv/intelbar.ppd Intellitech IntelliBar Label Printer, 2.1
drv:///sample.drv/okidata9.ppd Oki 9-Pin Series
drv:///sample.drv/okidat24.ppd Oki 24-Pin Series
raw Raw Queue
Library/Printers/PPDs/Contents/Resources/RWTS PDFwriter.gz RWTS alicloudprint
drv:///sample.drv/zebracpl.ppd Zebra CPCL Label Printer
drv:///sample.drv/zebraep1.ppd Zebra EPL1 Label Printer
drv:///sample.drv/zebraep2.ppd Zebra EPL2 Label Printer
drv:///sample.drv/zebra.ppd Zebra ZPL Label Printer

2、lpstat 查看打印机状态

$ lpstat -p
打印机 文印驱动自行修改 闲置,启用时间始于 一  1/21 16:32:04 2019
打印机 airprint1 闲置,启用时间始于 三 12/12 14:48:00 2018
打印机 cloudprint_2 闲置,启用时间始于 三 12/12 14:49:53 2018
打印机 PDFwriter 闲置,启用时间始于 四  3/21 17:33:07 2019

五、相关编程框架 PrintCore

PrintCore 框架包含在 ApplicationService 中。
是一套 C Api 可用于 Mac App 和 命令行工具来执行打印的任务,没有界面。


PrintCore 相关文件

  • PrintCore.h
  • PMCore.h
  • PMDefinitions.h
  • PMPrintAETypes.h
  • PMPrintSettingsKeys.h
  • PMErrors.h
  • PDEPluginInterface.h
  • PMPrintAETypes.h
  • PMPrintingDialogExtensions.h
  • PMPrintSettingsKeys.h

相关类

  • PMPrintSession for general information about a print job , 描述一个打印任务。

  • PMPrintSettings for print job parameters

  • PMPageFormat for the page format of a printed document

  • PMPaper for information about a type of paper

  • PMPrinter for information about a printer


参考

猜你喜欢

转载自blog.csdn.net/lovechris00/article/details/89099032