Print / Select a paper size other than A4 when using lp command line utility
Under Linux / UNIX you use lp command to print files from command prompt. lp is quite useful when GUI is not installed on Linux box to print files. The lp command is simply a front end command that calls the lpr command with appropriate options. Its main use is to allow the running of precompiled binary programs and scripts that assume that the lp command is the official printing command.
Changing papa size is very easy under GUI environment. But how do you change paper size under command prompt?
By default lp print to A4 paper size. However sometime you need to print to different paper size from command prompt such as A3 or A5. To print to A3 size, enter:
$ lp -o media=A3 /path/to/file
Where,
- -o media=size : Sets the page size to size. Most printers support at least the size names "a4", "letter", and "legal".
Other useful examples
Print a double-sided legal document to a printer called "hpljf2":
$ lp -d hpljf2 -o media=legal -o sides=two-sided-long-edge /path/to/file
Print an image across 4 pages using a printer called "epd2":
$ lp -d epd2 -o scaling=200 filename
Print a text file with 12 characters per inch, 8 lines per inch, and a 1 inch left margin to a printer called "lpodc2":
$ lp -d lpodc2 -o cpi=12 -o lpi=8 -o page-left=72 ~/info.txt
To know more about lp option, enter:
$ man lp
Please note that you need to configure print using CUPS configuration file /etc/cups/cupsd.conf or web based tool located at http://localhost:631/

(Fig 01: My CUPS Configuration, showing HP PhotoSmart Printer )
Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or full RSS feed to get all updates.
You can Email this page to a friend.
You may also be interested in...
- How to compile a 32-bit application using gcc on the 64-bit Linux version
- Determine the block size on hard disk filesystem for disk quota
- Display IP Address Allocation Table According to Subnet Mask
- xrandr: Linux resize screen size quickly
- Postfix mail server limit the mailbox size
Discussion on This Article:
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: a3, a5, cpi, cups print, duplex print, left margin, legal document, Linux, linux hp print, linux lp options, linux lp print, long edge, lp command, lpi, lpr command, print postscript, print setup, print unix, printers, printing command, spool print, UNIX, unix lp print ~ Last updated on: December 21, 2007



good with familiar topics