Monday, September 1, 2014

[Quick Tips] : Setting up a printer and printing duplex (two-sided) jobs from command line

Setting up a printer and printing duplex (two-sided) jobs from command line


To set up a printer, connect to http://localhost:631 on your browser. This will bring up the CUPS web interface. Adding a printer and changing the configuration should be a cinch once you get to this page. To enable 2-sided printing, do the following:
  • Go to Administration (tab) > Manage Printers > Set Printer Options
  • Under ‘Options Installed’, enable ‘Duplexer’ and click on ‘Set Printer Options’
  • Now, you’ll be presented with options to change the settings for 2-sided printing under ‘General’. Select ‘Long Edge (Portrait)’ and click ‘Set Printer Options’ to set 2-sided printing as the default setting.
To print files 2-sided from the terminal, use the following command:
lpr -P HPLaserJet -o Option1=True -o PageSize=A4 -o PageRegion=A4 -o Resolution=300dpi -o InputSlot=Default -o Duplex=DuplexNoTumble filename.pdf[Change HPLaserJet to match your printer's name.]

No comments: