Creating LTO barcodes

At work we use LTO-2 and LTO-3 tape-robots, which use barcodes to identify tapes. However, these barcodes can be very expensive and hard to come by. This made me look for a method to create the barcodes myself.

I’ve put my web-based version on a new page: Barcode Generator

I found Terry Burton’s ‘postscriptbarcode‘. Which is capable of creating the required ‘Type 39’ barcodes.

After mucking about in postscript (which is not something I do with pleasure…) for a while I got a decent working layout/method to create my barcodes. It can be automated even more, but I only need 1 or 2 sheets of barcodes, so I’ll leave this as an exercise for the reader :).

  1. Download ‘postscriptbarcode‘, and extract barcode_with_sample.ps from it
  2. Remove the lines (near the end) between ‘Helvetica findfont’ and ‘showpage’
  3. Replace the lines with the output of genbarcodes.sh (included below)
  4. Preview the file in evince or a viewer of choice
  5. Print the postscript file, preferably on sticker-paper, cut and stick on tapes

The required barcode-lines can be generated with the following simple bash script:

#!/bin/bash

BASE=”100″;
NR=$BASE

for hor in 30 220 410
do
ver=740
while [ $ver -ge 40 ];
do
printf -v FNR “(%06dL3)” $NR
echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode”
let ver=$ver-70
let NR=NR+1
done
done

Replace ‘BASE’ with the number where you want to start numbering, it is incremented by 1 for each barcode, and the barcodes are formatted with the number, filled to 6 digits, appended with ‘L3’. The coordinates are for A4 format paper.

The resulting pdf example of the above script.