1, CUPS introduction
CUPS is a modular open source printing system, which uses Internet Printing Protocol (IPP) as the basis to manage printers, print requests and print queues. CUPS supports network printer browsing and printing options based on PostScript printer descriptions. CUPS also provides a common print interface across the local network.
IPP is a standard protocol for network printing. Similar to other IP based protocols, you can use IPP to communicate with remote printers locally or over the Internet. But different from other protocols, IPP also supports access control, authentication and encryption, making it a much more powerful and secure printing solution than other protocols. IPP is located at the top level of Hypertext Transfer Protocol (HTTP). HTTP is the basic protocol of Web server in the Internet. When using IPP, you can verify the status information of the printer or server, manage the printer, and print jobs through the browser. CUPS is a complete printing system based on IPP/1.1. It provides basic digest local certificate authentication and user, domain or IP based access control.
CUPS includes support for dynamic printer detection and grouping. CUPS will replace the lpr command with its own command and the LPD printer driver with its own print driver. CUPS is similar to LP printing service in that it also uses PostScript format as its underlying language for page description. Because CUPS provides System V and Berkeley print commands, users and applications can print to CUPS queues with little or no change to the previously used options.
Finally, CUPS also includes an application level interface used by many open source applications and toolkits. At the back end, CUPS includes the interface needed to process the annotated raster image format (RIP). Support for this format and these interfaces has been integrated into other key open source print driver technologies.
1. CUPS can be used and print managed in the following ways:
1). CUPS command line utility: these commands include new CUPS print commands and some print commands previously used by the LP print service.
2). CUPS Web browser interface: http://localhost:631 .
3). CUPS print manager GUI: type the system config printer command in a terminal window to access this GUI.
2.CUPS process
In order for CUPS to manage the print environment, you must first create a print queue under CUPS. The print queue can point to a printer directly connected to the system through a USB port or a parallel port. However, queues can also point to network printers, Internet printers, or multiple printers, depending on how you configure your application. No matter where the queue points, the system treats the print queue the same way as any other printer.
3.CUPS service
CUPS service is provided through the following two new service management facility (SMF) services:
svc:/application/cups/scheduler
This service manages the cupsd daemon. This daemon provides basic print services including queuing, filtering, spooling, notification, IPP support, device enumeration, and Web management.
svc:/application/cups/in-lpd
This service runs the cupsd LPD daemon. This daemon provides basic RFC-1179 (LPD protocol) support for CUPS services.
Manage configuration files and solaris.com through printers smf. manage. Cups authorization, users without root login permission can also manage these SMF services.
2, CUPS command line
1. View printer status
Many systems will have more than one printer available to users. These printers can be connected to the local system through parallel, serial or USB ports, or can be used through the network. Use the lpstat command to view the list of available printers:
$ lpstat [option]
Option meaning -p Check whether the printer is idle, enable or disable the time; If followed by the printer name, only the specified printer information is viewed. -d View the default printer name. -v See what device the printer name is associated with. -t display CUPS Information about the status (including the status of all printers), such as whether the printer is active and whether to accept printer requests.
demonstration:
hollowman@hollowman-F117:~$ lpstat -p printer HP_LaserJet_MFP_M72625dn_ Currently free. From 14:08:42 on Friday, August 6, 2021 hollowman@hollowman-F117:~$ lpstat -d System default target: HP_LaserJet_MFP_M72625dn_ hollowman@hollowman-F117:~$ lpstat -v be used for HP_LaserJet_MFP_M72625dn_ Equipment: ipp://HP%20LaserJet%20MFP%20M72625dn%20(NPIFC1C44)._ipp._tcp.local/ hollowman@hollowman-F117:~$ lpstat -t Scheduler running System default target: HP_LaserJet_MFP_M72625dn_ be used for HP_LaserJet_MFP_M72625dn_ Equipment for: ipp://HP%20LaserJet%20MFP%20M72625dn%20(NPIFC1C44)._ipp._tcp.local/ HP_LaserJet_MFP_M72625dn_ Requests have been accepted since 14:08:42 on Friday, August 6, 2021 printer HP_LaserJet_MFP_M72625dn_ Currently free. From 14:08:42 on Friday, August 6, 2021
2. Display or set printer options and defaults
$ lpoptions -d printer-name
demonstration:
hollowman@hollowman-F117:~$ lpoptions -d HP_LaserJet_MFP_M72625dn_ copies=1 device-uri=ipp://HP%20LaserJet%20MFP%20M72625dn%20(NPIFC1C44)._ipp._tcp.local/ finishings=3 job-cancel-after=10800 job-hold-until=no-hold job-priority=50 job-sheets=none,none marker-change-time=1628230122 marker-colors=#000000 marker-high-levels=100 marker-levels=67 marker-low-levels=5 marker-message=marker-message marker-names='Black Toner_S/N_:CRUM-190319A0685' marker-types=toner number-up=1 printer-commands=none printer-info=HP printer-is-accepting-jobs=true printer-is-shared=false printer-is-temporary=false printer-location='Local Printer' printer-make-and-model='LaserJet MFP M72625dn - IPP Everywhere' printer-state=3 printer-state-change-time=1628230122 printer-state-reasons=none printer-type=2273364 printer-uri-supported=ipp://localhost/printers/HP_LaserJet_MFP_M72625dn_
3. Print documents
CUPS can directly understand many different types of files, including text, PostScript, PDF and image files. This allows you to print from within the application or from the command line in the most convenient way!
Print files to the default printer on your system
$ lp filename $ lpr filename
demonstration:
hollowman@hollowman-F117:~$ lp 1.txt request ID by HP_LaserJet_MFP_M72625dn_-5(1 (files)
Print files to the selected printer
$ lp -d destination-printer filename $ lpr -d destination-printer filename
-d specifies the destination printer, destination printer represents the name of the target printer, and filename specifies the file name to print.
demonstration:
hollowman@hollowman-F117:~$ lp -d HP_LaserJet_MFP_M72625dn_ 1.txt request ID by HP_LaserJet_MFP_M72625dn_-6(1 (files)
The lp and lpr commands also support printing from standard input:
$ program | lp $ program | lp -d printer-name $ program | lpr $ program | lpr -P printer-name
Demo:
hollowman@hollowman-F117:~$ echo 'haha' | lp request ID by HP_LaserJet_MFP_M72625dn_-9(0 Files)
4. Specify print options
$ lp [-o Option value] printer-name Options: -o media=size Set the media size, type, or source (see below) -o orientation-requested=N Set paper rotation portrait (3) or landscape (4) orientation -o print-quality=N Set paper quality - Low quality (3), standard (4), high-quality (5) -o sides=one-sided Set single sided printing(default) -o sides=two-sided-long-edge Set up duplex long edge printing -o sides=two-sided-short-edge Set duplex short edge printing
-O size reference value in media = size:
- Letter - US Letter (8.5x11 inches, or 216x279mm) - American letter (8.5 x11 in, or 216x279 mm)
- Legal - US legal (8.5x14 inches, or 216x356mm) - US legal (8.5x14 inches, or 216x356mm)
- A4 - ISO A4 (8.27x11.69 inches, or 210x297mm) - ISO A4(8.27 x11.69 inches, or 210x297mm)
- COM10 - US #10 Envelope (9.5x4.125 inches, or 241x105mm) - USD £ 10 envelope (9.5x4.125 inches, 241x105mm)
- DL - ISO DL Envelope (8.66x4.33 inches, or 220x110mm) - ISO DL envelope (8.66 x4.33 inches, or 220x110mm)
- Transparency - Transparency media type or source - transparent media type or source
- Upper - Upper paper tray
- Lower - Lower paper tray - lower the paper tray
- Multipurpose - multi purpose paper tray
- LargeCapacity - Large capacity paper tray
demonstration:
hollowman@hollowman-F117:~$ lp -o media=A4,MultiPurpose 1.txt request ID by HP_LaserJet_MFP_M72625dn_-9(0 (files)