'How do I enable duplexer of a printer with macOS terminal?
I am writing a script to automatically setup the printer for macOS, and need to set the printer-type param in order to enable the duplexer. I failed with the command: lpoptions -d my_printer_name -o printer-type=xxx.
Details:
- I added the printer successfully with
lpadmin, but it can not make a two-sided print. - Then I found that I should go to
System Preferences - Printers & Sacnners - Options & Suppliesand enableDuplexerunderOptionstab, as shown in this picture. Enable Duplexer. - Then I checked the
lpoptionssettings for my printer and found that the difference between enabled and disabled duplexer is theprinter-typeparameter:- For enabled duplexer,
printer-type=2109508while for disabled duplexer,printer-type=2109524.
- For enabled duplexer,
- Therefore, I was thinking to set the
printer-typeparam bylpoptions -d my_printer_name -o printer-type=2109524, but theprinter-typedid not change as expected.
The script is shown below, it can add the printer but can not enable the duplexer.
printer_driver="drv:///sample.drv/generpcl.ppd"
black_white_printer_name="BlackWhitePrinter"
black_white_printer_device="socket://xxxxxx/"
lpadmin -p $black_white_printer_name -E -v $black_white_printer_device -m $printer_driver -o printer-is-shared=false
# set default printer
# -o printer-type=2109524 does not work
lpoptions -d $black_white_printer_name -o printer-type=2109524
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
