Skip to end of metadata
Go to start of metadata

Description

When an EAN13 barcode is created using Loftware Label Manager, the barcode includes a human readable by default. Due to the nature of the barcode and the positioning of the text, the font for the human readable is not configurable. The solution is to remove the default human readable and create individual fields for each of the 3 segments and then use a formula or script to populate them.

How to create an EAN13 barcode with a specific human readable font

The following is a sample of an EAN13 Barcode with the default font.

 

The data for the barcode can be created two ways.

If 12 characters are passed as barcode data, Loftware will compute the check digit prior to printing. If all 13 characters are passed as barcode data, no computation is necessary. It is the two 12 character options that require additional work.

Use the following procedure.

  1. Set the Human Readable value for the barcode to None.

  2. Create 3 fields of the appropriate size and font and place them appropriately.
  3. Now to populate them. There are 3 options:
    1. Option 1: Set the "Max # Chars" to 13, submit all 13 character including the check digit, and use a formula to parse the data into the 3 fields.
      • left(EAN13,1)
      • mid(EAN13,2,6)
      • right(EAN13,6)
    2. Option 2: Set the "Max # Chars" to 12, submit 12 characters of data, and use formulas to compute the parse the data and compute the check digit.
      • left(EAN12,1)
      • mid(EAN12,2,6)
      • right(EAN12,5) & right(10 - (right(((mid(EAN12,1,1)*1) + (mid(EAN12,2,1)*3) + (mid(EAN12,3,1)*1) + (mid(EAN12,4,1)*3) + (mid(EAN12,5,1)*1) + (mid(EAN12,6,1)*3) + (mid(EAN12,7,1)*1) + (mid(EAN12,8,1)*3) +  (mid(EAN12,9,1)*1) + (mid(EAN12,10,1)*3) + (mid(EAN12,11,1)*1) + (mid(EAN12,12,1)*3)),1)),1)
    3. Option 3: Submit 12 or 13 characters and use a script to parse the data and compute the check digit if necessary.

      Script
      var ean12 = GetData('EAN12');
      var ean13 = GetData('EAN13');
      var mod10=0;
      var calc=0;
      // Start Mod10 calc
      for (i=0;i<13;i++){
       if (i%2==1){
        calc+=(ean12.charAt(i)*3);
       }
       else{
        calc+=(ean12.charAt(i)*1);
       }
      }
      mod10=10-((calc%10)%10);
      if (mod10==10)
      {mod10=0;}
      // End Mod10 Calc
      var ean12hr = String(ean12)+String(mod10);
      PutData('EAN12_1',ean12hr.slice(0,1));
      PutData('EAN12_2',ean12hr.slice(1,7));
      PutData('EAN12_3',ean12hr.slice(7));
      // Functions
      function GetData(fieldName)
        {
        return String(label.fields.field.(@name==fieldName).@data);
        }
      
      function PutData (fieldName,output)
        {
       label.fields.field.(@name==fieldName).@data=output;
       }

A sample label is attached: EAN Custom HR.lwl

Article Number

2017141

Versions

All supported versions of the Loftware Label Manager

Environment

Any supported LPS family product environment