lpr

From RaySoft

lpr submits files for printing. Files named on the command line are sent to the named printer or the default destination if no destination is specified. If no files are listed on the command-line, lpr reads the print file from the standard input.[1]

Documentation

Syntax

lpr [PARAMETER ...] [FILE ...]

Parameters

-# NUMBER
Sets the NUMBER of copies to print.
-m
Send an email on job completion.
-o OPTION[=VALUE]
Sets a job OPTION. See Job Options below.
-P DESTINATION[/INSTANCE]
Prints files to the named printer.

Job Options

job-sheets=NAME
Prints a cover page (banner) with the document. The NAME can be classified, confidential, secret, standard, topsecret, or unclassified.
media=SIZE
Sets the page size to SIZE. Most printers support at least the size names a4, letter, and legal.
number-up=2|4|6|9|16
Prints 2, 4, 6, 9, or 16 document (input) pages on each output page.
sides=one-sided
Prints on one side of the paper.
sides=two-sided-long-edge
Prints on both sides of the paper for portrait output.
sides=two-sided-short-edge
Prints on both sides of the paper for landscape output.

Examples

Generate and print a QR code for my Wi-Fi based on a SSID and a password from Bitwarden
ssid="$(bw get --raw 'username' 'Wi-Fi Shared Password')"
passwd="$(bw get --raw 'password' 'Wi-Fi Shared Password')"

qrencode --dpi=300 --output=- --size=100 \
  "WIFI:S:${ssid};T:WPA2;P:${passwd};;" \
| lpr -P 'Brother_HL_525DN_series' -o 'media=a4' -o 'number-up=4'

unset -v ssid passwd

References

  1. man 1 'lpr'