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 –

  • 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 ( 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 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()
        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 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

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



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.