≡ Menu


How To: Print Labels in Ubuntu Linux

I haven't had to use MS-Office / word in years and I have never had a problem with awesome OpenOffice.org software. I have been using it in Linux for a long time, and recently at work we started using it in windows-xp systems too. I have also got a couple other people in my school, work and small business to use it as well. This tutorial explains the approach you take when you want to print labels under Ubuntu Linux using gLabels. It is a label, business and media cover designer for the GNOME. The intuitive editor allows to create text fields, insert images, simple objects, and create barcodes. It is designed to work with common laser/inkjet printers peel-off label and business card sheets. From the article:

Ubuntu has no shortages of software for printing labels. Many users content themselves with the label and mail merge features in OpenOffice.org Writer or in Abiword or KOffice. All these solutions will do a basic job, especially with text. But what if you want elaborate formatting or graphics with your labels? What if you want a smaller, dedicated program that is quicker to load than a complete word processor? In these cases, you should consider turning to gLabels instead.

=> Printing Labels in Ubuntu

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

  • -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/
Linux / UNIX CUPS HP printer at http://localhost:631/
(Fig 01: My CUPS Configuration, showing HP PhotoSmart Printer )