In fact, it is very easy to use the lpadmin command. An example is given below:
printername="YOUR_PRINTER_NAME"location="LOCATION INFO"gui_display_name="HP Color LaserJet M600 in Office for Example"address="ipp://printserver.yourcompany.org/YOUR_PRINTER_NAME"driver_ppd="/Library/Printers/PPDs/Contents/Resources/hp color LaserJet M600.gz"# Populate these options if you want to set specific options for the printer. E.g. duplexing installed, etc.option_1=""option_2=""option_3=""# Now we can install the printer./usr/sbin/lpadmin \ -p "$printername" \ -L "$location" \ -D "$gui_display_name" \ -v "$address" \ -P "$driver_ppd" \ -o "$option_1" \ -o "$option_2" \ -o "$option_3" \ -o printer-is-shared=false \ -E
Description of the parameters:
Printername: When the printer is generated, CUPS is used as the file name of the printer.
Location: the physical location of the printer, such as the Financial Office or front-end printer. This information is optional.
Gui_displayname: printer name displayed in GUI
Address: CUPS supports multiple Protocol formats, such as lpd, ipp, dnssd, smb, http, Socket, and mdns. The specific situation depends on the specific network environment. If you are not sure how to write data, you can manually install it in the GUI on the test machine to obtain this address.
Driver_ppd: the path of the driver's ppd file.
Option: for example, if you want to set dual-sided printing to off by default, Most printers use Duplex = none. For specific parameters, see different printers.
You can complete the configuration on the test machine and then run the following command:
lpoptions -p YOUR_CUPS_PRINTER_NAME -l
To display all the parameter configurations of the printer. There is no limit on the number of options in the lpadmin command.