Barcode Printing

Patient registration in Rwanda is performed using barcodes which allow staff to quickly and accurately identify a patient who has arrived at a clinic. These are printed on labels which are then stuck onto the patient carne booklet.

Printer setup

The printers used are Zebra label printers. Some are TLP 2844 models and others are GK420t models. There are no native drivers for Linux or Mac OSX for these printers, but they can be easily installed on these systems using CUPS. On Mac OSX computers, CUPS is preinstalled. On Ubuntu it can be installed as a package:

sudo apt-get install cups cups-ppdc

The CUPS administration is web-based and by default can be accessed from http://localhost:631. On Ubuntu, user accounts need to be added to the lpadmin group in order to access the CUPS administration pages, e.g.

sudo usermod -aG lpadmin <username>

To add a barcode printer to CUPS, first ensure that it is switched on and plugged into the system on which you want to install it.

  1. Click on the Administration tab at http://localhost:631
  2. Click the Add printer... button
  3. You should be able to select your barcode printer from the list of printers, e.g.
  4. Give the printer a unique name and take a note of it
  5. For Model, specify Zebra EPL2 Label Printer and continue
  6. Select the media size of the labels you will be using. Leave the resolution setting at 203dpi unless you know for sure that your label printer has a different native resolution
  7. Your label printer is now installed

Loading labels

When loading labels into the printer it is necessary to align the media so that printing occurs on the correct part of each label. Zebra printers are able to do this by auto-sensing where the division between each label is

  1. With the printer switched off, check that the labels and ribbon are properly loaded
  2. Press and hold the feed button then switch the printer on
  3. Continue to hold the feed button until the status light LED flashes, and then release it
  4. The printer will automatically feed until a label is positioned at the print head

On some models the printer will now remain in diagnostic dump mode. To exit this mode, press the feed button once more.


The registration module generates barcode labels as .epl files containing EPL commands. To test this you can print one of these files (here's an example file) using the CUPS command line tool, e.g.

lpr -P <printer-name> -l <epl-file>

Printing from the browser

The clerks will be creating the barcode labels in OpenMRS which they are accessing in Firefox. Therefore we need to tell Firefox to send EPL files to the CUPS printing system.

  1. Create a shell script called in your home directory with the following content. Replace <printer-name> with the name of your barcode printer in CUPS:
    lpr -P <printer-name> -l $1
  2. Make that file executable
    chmod +x
  3. Register a patient and when the .epl file is opening Firefox will prompt you to select an application to handle that file type. Select the script and check the box to remember this choice.