Linux.com

Feature

Printing Avery labels with Linux

By Michael Stutz on August 10, 2006 (8:00:00 AM)

Share    Print    Comments   

To aid users in the task of label printing, Avery Dennison offers a host of free (to download) software, including a program for the Mac released late last month. Linux still isn't supported, but that's no matter -- there's more than one open source application for Linux that lets you format text for printing on the whole universe of Avery labels, from DVD covers to business cards. Here's a look at them.

LabelNation

One versatile program written for the express purpose of printing on Avery labels is Karl Fogel's Python-based LabelNation.

It outputs formatted PostScript that you can either save to a file or send directly to the print spooler, if you have a PostScript printer or a print filter that converts incoming PostScript to something that your printer understands. You can print from a database of addresses on a single run, such as for printing a mailing list, and in addition to plain text input it can also take PostScript code -- which means you can print labels with graphics.

Once you have it downloaded and installed (just put the labelnation file in /usr/local/bin), you can get a list of its predefined labels with the --list-types option:

$ labelnation --list-types

The latest version, 1.64, understands about 50 different labels, including the most popular Avery sizes as well as the Maco LL5805, LL8100, and LL8550 labels, and the Maverick ST340817.

To make output, you need to give several options. First, give the name of the label you want to use as an argument to the -t option. To read the input text from a file, give the file name as an argument to the -i option, and use the -l option to specify that the file is "line input," or lines of plain text.

By default, LabelNation writes a PostScript file named labelnation.ps in the current directory. To specify a file name, give it as an argument to the -o option:

$ labelnation -l -i address.txt -t avery-5160 -o address.ps

To print out a batch of mailing-list labels, use the -d option to specify the delimiter used between addresses in the input file. Be sure to quote it. For example, if you have a file called subscribers.txt where every address is separated by a single line containing a hash character, the following command will output PostScript for printing on Avery 5160 labels to a file called printme.ps:

$ labelnation -t avery-5160 -d "#" -i subscribers.txt -o printme.ps

You can use a PostScript file for the input by giving the -c option, as so:

$ labelnation -t avery-5160 -c -i winebottle.ps -o printme.ps

And you're not limited to the predefined label sizes, either. You can define your own custom sizes by first making a file containing various parameters, which are best described by looking at the parameters of an existing label type. To see the parameters for a particular label, run labelnation with the label type you're interested in and give the -l and --show-parameters options. For instance, to get the parameters for Avery 5160 labels:

$ labelnation -t avery-5160 -l --show-parameters
LeftMargin:      11
BottomMargin:    16
LabelWidth:      180
LabelHeight:     72
HorizSpace:      20
VertSpace:       0
HorizNumLabels:  3
VertNumLabels:   10
FontName:        Times-Roman
FontSize:        12
$

Your own parameter file should contain the parameters and their values (in PostScript points, which are 1/72 of an inch), as shown in the output above. Then, instead of giving a label type, call your parameter file as an argument to the -p option:

$ labelnation -p mylabels -i address

When you're defining custom labels, the --show-bounding-box option is also handy -- it just draws a box around each label, which is good for a test run. Print your boxed labels on a piece of scrap paper and hold it up to a label sheet to see if you have the correct size before printing on the label stock.

The full documentation is available with the --help option, which you'll want to send to a pager:

$ labelnation --help | less

Templates for OpenOffice.org

Users of OpenOffice.org will find a huge set of label templates available to them from the OO Extras and Worldlabel sites.

These templates handle many popular Avery sheets as well as a few others -- from printing Verbatim CD labels to those tab inserts used in Oxford hanging file folders.

LaTeX packages

The LaTeX markup language has had a number of solutions for printing Avery labels, and they've been available for years.

While the regular LaTeX letter class is capable of making labels (with the makelabels command), they're only sized for Avery 5352 labels; for more, get and install envlab, a macro package for envelopes and labels. It understands many common Avery sizes by name, but you can also specify your own dimensions for custom labels (or envelopes).

Other potentially useful LaTeX label packages include labelmac3, for printing on Avery 6150 labels, and the labels package, which you can use to print various kinds of labels.

Command-line scripts

Finally, there are a number of simple command-line scripts that, like LabelNation, take input text and output PostScript formatted for a particular kind of label sheet.

The best I've found are two public-domain Perl scripts written by Greg Ercolano. The first is avery-address, which prints return address labels on Avery 5160 or 5260 sheets.

To use it, give as quoted arguments the text you want on the three lines of the label. Then, redirect the output to a file or pipe it to the print spooler or previewer. For example, here's how you'd preview it with gv:

$ avery-address "Jane Smith" "14 Sycamore St." "Los Angeles, CA 90028" | gv -

The second script is avery-tapenum, which writes PostScript output for Avery 5267 labels, and can be used for labeling tapes, collections, or anything else with a numeric series. You give two arguments: the text used as offset and the first number to start with.

For example, here's how to print tape labels that are prefaced by the text "CLASSICS, vol." and begin numbering at 100:

$ avery-tapenum "CLASSICS vol. " 100 | lpr

Notice the blank space in the first argument; this is necessary, because otherwise the numbers would be written immediately after the word, with no space. This command prints labels such as:

CLASSICS, vol. 100
CLASSICS, vol. 101
CLASSICS, vol. 102

Share    Print    Comments   

Comments

on Printing Avery labels with Linux

Note: Comments are owned by the poster. We are not responsible for their content.

OpenOffice

Posted by: Anonymous Coward on August 13, 2006 07:25 AM
has no problem with Avery labels.

#

gLabels

Posted by: Anonymous Coward on August 10, 2006 08:04 PM
Another great tool for working with labels is <a href="http://glabels.sourceforge.net/" title="sourceforge.net">gLabels</a sourceforge.net>



It is a GUI (GTK+) tool for editing label layouts and printing them. It comes with a variety of templates and provides a GUI for creating custom templates as well.

#

GLabels

Posted by: Anonymous Coward on August 10, 2006 09:06 PM
I have been using GLabels for years and it absolutely blows away everything you mentioned in your article. Its extremely easy to use and supports a very wide range of labels. Please include a mention of this fine program.

#

gLabels

Posted by: Anonymous Coward on August 11, 2006 02:19 AM
Take a look at gLabels program, extremely easy and flexible.

#

Hate to beat a dead horse...

Posted by: Anonymous Coward on August 11, 2006 07:02 AM
I know I'm the fourth consecutive post mentioning gLabels, but there's a reason I feel people need to be aware that this article is incomplete. Users switching to Linux from Windows expect trivial tasks under their old OS to be similarly trivial under the new. gLabels accomplishes this with respect to printing labels. Command line programs do not. I'm not saying we should do away with, or neglect to mention the command line tools. I use CLI programs extensively. But not mentioning gLabels in this article was a major oversight.

#

Re:Hate to beat a dead horse...

Posted by: Anonymous Coward on August 11, 2006 10:33 PM
Why not one more mention of gLabels? Because no one has mentioned gLabels DOES have a CLI. It's called 'glabels-batch'. We use it to automate printing labels from our company database at work. Of course we create the label files in the GUI. It's a very slick system.
It doesn't suprise me the articles author missed this one. I've been using Linux for about five years and constantly keep finding really cool programs hidden in obscurity. Need Windows? Not here.

#

Another use for GLabels

Posted by: Anonymous Coward on August 11, 2006 11:15 PM
Yep, another confirmed GLabels user. Its one of the first programs I install on a new machine.

I have another use for it, beyond labels. I periodically need to make small announcements for various groups I belong to, along with birthday invites for my kids, etc. I made a custom "label" that fits four on a page, I can then design an invitation, and it prints them four-up and I can cut them. I have used this many times, it works great.

I do wish KDE had a similar program.

#

Re:Another use for GLabels

Posted by: Anonymous Coward on August 11, 2006 11:38 PM
KBarcode is a barcode and label printing application for KDE. It can be used to print everything from simple business cards up to complex labels with several barcodes (e.g. article descriptions).

KBarcode comes with an easy to use WYSIWYG label designer, a setup wizard, batch import of data for batch printing labels (directly from the delivery note), thousands of predefined labels, database management tools and translations in many languages. Even printing more than 10.000 labels in one go is no problem for KBarcode. Data for printing can be imported from several different data sources, including SQL databases, CSV files and the KDE address book.

Additionally it is a simple barcode generator (similar to the old xbarcode you might know). All major types of barcodes like EAN, UPC, CODE39 and ISBN are supported. Even complex 2D barcodes are supported using third party tools. The generated barcodes can be directly printed or you can export them into images to use them in another application.

KBarcode is free software released under the terms of the GNU GPL.

<a href="http://www.kbarcode.net/" title="kbarcode.net">http://www.kbarcode.net/</a kbarcode.net>

#

Glaring omission: Kbarcode!

Posted by: Anonymous Coward on August 11, 2006 11:39 PM
<a href="http://www.kbarcode.net/Home.4.0.html" title="kbarcode.net">http://www.kbarcode.net/Home.4.0.html</a kbarcode.net>

KBarcode is a barcode and label printing application for KDE. It can be used to print everything from simple business cards up to complex labels with several barcodes (e.g. article descriptions).

KBarcode comes with an easy to use WYSIWYG label designer, a setup wizard, batch import of data for batch printing labels (directly from the delivery note), thousands of predefined labels, database management tools and translations in many languages. Even printing more than 10.000 labels in one go is no problem for KBarcode. Data for printing can be imported from several different data sources, including SQL databases, CSV files and the KDE address book.

Additionally it is a simple barcode generator (similar to the old xbarcode you might know). All major types of barcodes like EAN, UPC, CODE39 and ISBN are supported. Even complex 2D barcodes are supported using third party tools. The generated barcodes can be directly printed or you can export them into images to use them in another application.

KBarcode is free software released under the terms of the GNU GPL.


 

#

LoL. Lables?

Posted by: Anonymous Coward on August 15, 2006 07:35 AM
My grandma figured this out on windoze years ago. Frankly, I expected more from Linux. You guys crack me up. And the command line tools, for achieving this? LOL. Seriously guys!!

#

I know you'll be surprised at this but...

Posted by: Administrator on August 11, 2006 12:07 PM
Yes, it's one more "Me too!" for gLabels. Normally I wouldn't post such a massively redundant comment but the way that the original article missed the boat on this is really shocking. It's almost like doing an article about browsers for Linux and not mentioning Firefox.


I don't mean this to be a flame or anything. It's just so unreal I can't not say something.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya