GS1 EAN/UPC Barcode Magnification Factor with Neodynamic Barcode Professional

The GS1 General Specifications states the dimensions and tolerances for EAN/UPC barcodes (EAN-13, EAN-8, UPC-A & UPC-E). In this post, we’ll summarize them and provide you a sample code for reproducing the well known “Magnification Factor” feature using our Barcode Professional products line.

EAN/UPC Dimensions & Tolerances (From GS1 General Specifications – 5.2.2.4.)

  • X-dimension: Barcodes can be printed at various densities to accommodate a variety of printing and scanning processes. The significant dimensional parameter is X, the ideal width of a single module element. In Barcode Professional, this is specified with BarWidth property. The X-dimension at nominal size is 0.33 millimeter (= 0.013 inch).

    NOTE: GS1 Spec (5.2.2.4.1.) states some exceptions to this size for Characters 1, 2, 7, and 8 where is applied a Reduction/Enlargement on bars which compose those characters. Barcode Professional does honor this exception!

  • Symbol Height:
    • For EAN-13, UPC-A, and UPC-E Barcodes the approximate height of the symbol, including the human readable information, at the nominal size is 25.9 millimeters (= 1.0 inch).
    • For EAN-8 Barcodes the approximate height of the symbol, including the human readable information, at the nominal size is 21.3 millimeters (= 0.8 inch).
  • X-Dimension – Magnification Factor: In the past the term “magnification factor” was extensively used to specify the size of a barcode. This technique relied upon setting a nominal size (100%) that was directly related to a given X-dimension. Since January 2000, the more precise term “X-dimension” has been used to specify permissible symbol sizes
  • Human Readable Text: The human readable digits shall be printed underneath the main symbol and above the Add-On Symbol. A clearly legible font shall be used for these digits (OCR-B font is recommended but NOT mandatory! Reasonable alternative type fonts and character sizes are acceptable provided the Human Readable Text is clearly legible) The height of the digits in the nominal size symbol is 2.75 millimeters (= 0.11 inch).

The GS1 General Spec at 5.2.4.7. provides a matrix for “Dimensions of Modules and Symbols at Different Levels of Magnification”. The following Windows Forms sample uses Barcode Professional SDK 3.0 for reproducing the margnification factor feature on EAN-13 barcodes. The code does some calculations for the X-dimension (BarWidth), the Symbol Height (BarHeight and GuardBarHeight) as well as for the font size.

Barcode Professional settings for reproducing GS1 EAN/UPC Magnification Factor feature

To reproduce this in your machine:

  • Download & Install Neodynamic Barcode Professional SDK for .NET
  • Open Visual Studio or any VS Express Edition and create a new Windows Forms Application project
  • On the default form (Form1) place a Label and a Trackbar. On the Trackbar control set Minimum = 80, Maximum = 200 and Value = 100
  • In the code behind class just ccopy/paste the following code. NOTE: Ensure you bind the Paint event of the Form to Form1_Paint method and the Scroll event of the Trackbar control to trackBar1_Scroll method

using System;
using System.Drawing;
using System.Windows.Forms;
using Neodynamic.SDK.Barcode;

namespace BarcodeEanUpcMagnificationFactor
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            using (BarcodeProfessional barcodePro = new BarcodeProfessional())
            {
                barcodePro.AutoSize = true;

                barcodePro.DisplayLightMarginIndicator = true;
                barcodePro.UseQuietZoneForText = true;
                barcodePro.DisplayChecksum = true;
                barcodePro.DisplayStartStopChar = true;
                barcodePro.AddChecksum = true;
                barcodePro.AntiAlias = false;
                barcodePro.DisplayCode = true;
                barcodePro.Symbology = Symbology.Ean13;

                barcodePro.Code = "123456789012";

                //nominal size at 100% (See 5.2.2.4. Dimensions and Tolerances of GS1 Global Spec)
                double barWidth = 0.33;
                double barHeight = 25.91;
                double guardBarHeight = barHeight + 5 * barWidth;
                double quietZone = barWidth * 11;

                //get current magnification factor
                double magnificationFactor = (double)this.trackBar1.Value / 100;

                barcodePro.BarcodeUnit = BarcodeUnit.Millimeter;

                barcodePro.BarWidth = barWidth * magnificationFactor;
                barcodePro.BarHeight = barHeight * magnificationFactor;
                barcodePro.GuardBarHeight = guardBarHeight * magnificationFactor;
                barcodePro.QuietZoneWidth = quietZone * magnificationFactor;

                //set and scale font... (font size at nominal scale is 2.75mm - 5.2.4. Human Readable Interpretation)
                float fntSize = 2.75f * (float)magnificationFactor;

                using (Font fnt = new Font("Arial", fntSize, GraphicsUnit.Millimeter))
                {
                    barcodePro.Font = fnt;

                    //draw barcode
                    barcodePro.DrawOnCanvas(e.Graphics);
                }
            }
            
        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            this.label1.Text = "Magnification Factor: " + ((double)this.trackBar1.Value/100).ToString();

            this.Invalidate();
        }
    }
}

Advertisements

Barcode Professional 2.0 for Silverlight just released!

We’re very proud to announce the availability of Barcode Professional 2.0 for Silverlight. This new major release added support for GS1 Data Matrix, MICR E-13-B, all the EAN.UCC Composite family as well as some enhancements to QR Code, Aztec Code & Data Matrix which now support ECI (Extended Channel Interpretation) & FNC1 (For further details, please refer to our post GS1 Data Matrix, MICR E-13-B and EAN.UCC Composite added to Barcode Professional product lines)

Barcode Professional 2.0 targets Silverlight 4.0 and will target the recently announced Silverlight 5.0 (when it becomes available to the market in 2011)

Regarding the future features on Silverlight 5.0, one particulary interesting for our product is the “Postscript vector printing” which will allow LOB apps to take full advantage of it for generating high quality output report printings.

Download now Barcode Professional 2.0 for Silverlight and give it a try!