Address Labels

I hate writing address label programs.  I wrote address label programs in COBOL for line-printers with fanfold paper in the 1980's.  Word processors have been invented since then and fewer people need address labels.  However people still do need address labels from time-to-time, and they'll be happy if they can just put the labels in the printer and run a list without having to fuss with boilerplates and .csv files.

A customer called and their current version of Open Office wasn't merging their .csv files the way it used to.  I pulled in Libre Office, and that failed too (but in a different way).   Now I have close to 500 labels I need to produce and my favorite open source word processors have left me swinging.

So I pulled LaTeX out of my toolbox.  It took me a few clumsy attempts before I found this link:

http://www.math.northwestern.edu/resources/computer_information/template/mlabels.html

and discovered LaTeX had a package for labels already!

Here's the few lines for an 5161 label:

\documentclass[letterpaper,12pt]{article}
\usepackage{labels}
\LabelCols=2
\LabelRows=10
\LeftBorder=8mm
\RightBorder=4mm
\TopBorder=.75in
\BottomBorder=.35in  %.25 close
\LabelInfotrue
\begin{document}
\begin{labels}
\input{customer_list.dat}
\end{labels}
\end{document}

And that's it.  And the customer_list.dat file is just address lines in a single column with a blank line between each record.  So armed with that little bit of code, I was able to stab in a small Perl script to toss the .csv file into a pdf suitable for printing labels.

 

Posted by

Share: