Tuesday, July 14, 2015

CUPS Command Line Interfaces

CUPS Command Line Interfaces


You can also simply use the command line to administer the printers. You can add a network printer enable the printer with:


  # lpadmin -p hplj -v socket://192.168.0.6:9100/ -E

Another example for a LPD print server:


  # lpadmin -p lp1nd -v lpd://printhost/lp1nd -E

To add information about the Location and a Description of the printer:


  # lpadmin -p lp0 -L "Level 2 South" -D "HP LaserJet 4"

To specify a PPD for the printer:


  # lpadmin -p lp7 -P /usr/share/postscript/ppd/HP_LaserJet_4050_Series.ppd
  # lpadmin -p lp11 -P LEXC750.PPD

The PPD file is copied into /etc/cups/ppd/lp11.ppd, for example.
You can look at the printer options (assuming it has a PPD) with:


  # lpoptions -p lp7 -l

And you can set options with:


  # lpoptions -p lp7 -o PageSize=A4
  # lpoptions -p lp1 -o PageSize=A4

And so on. These options are placed in /etc/cups/lpoptions. The same options can be set using the web interface. The web interface is indeed somewhat easier to use, and it modifies the PPD file directly (e.g., /etc/cups/ppd/lp1.ppd) rather than using the /etc/cups/lpoptions file!
You can access printer options directly from the command line when printing, if the printer's PPD supports the option. For example, the HP LaserJet 4050 driver I'm using (from hp-ppd) supports n-up printing and watermarks:




  $ lp -o HPNup=TwoUpL sample.pdf
  $ lp -o HPwmText=Draft odbcmine.pdf

No comments:

Post a Comment

  How to Change Instance Type & Security Group of EC2 in AWS By David Taylor Updated April 29, 2023 EC2 stands for Elastic Compute Cloud...