IRONSOFTWAREHOME
Override ECI Encoding for One Barcode
using IronBarCode;

// Application-wide policy
BarcodeWriter.DefaultEciMode = EciMode.Auto;

// Per-call EciMode overrides the default for this barcode only
GeneratedBarcode compliance = DataMatrixWriter.CreateDataMatrix("LOT-4471-A", 200, EciMode.ForceUtf8);
compliance.SaveAsPng("compliance-label.png");

// No argument, so this one follows the default
GeneratedBarcode standard = DataMatrixWriter.CreateDataMatrix("LOT-4471-B", 200);
standard.SaveAsPng("standard-label.png");
Imports IronBarCode

' Application-wide policy
BarcodeWriter.DefaultEciMode = EciMode.Auto

' Per-call EciMode overrides the default for this barcode only
Dim compliance As GeneratedBarcode = DataMatrixWriter.CreateDataMatrix("LOT-4471-A", 200, EciMode.ForceUtf8)
compliance.SaveAsPng("compliance-label.png")

' No argument, so this one follows the default
Dim standard As GeneratedBarcode = DataMatrixWriter.CreateDataMatrix("LOT-4471-B", 200)
standard.SaveAsPng("standard-label.png")
NuGet Download
PM > Install-Package BarCode
Override ECI Encoding for One Barcode

Override ECI Encoding for One Barcode

Most applications want a single ECI policy across every barcode they produce, but occasionally one symbol has to differ. A label bound for a compliance system may need to declare its encoding explicitly while the rest of the output stays compact. The CreateDataMatrix overloads accept an EciMode argument for exactly this case, overriding the application-wide default for that one call.

4-Step Guide to Overriding ECI Encoding for One Barcode

  • using IronBarCode;
  • BarcodeWriter.DefaultEciMode = EciMode.Auto;
  • GeneratedBarcode compliance = DataMatrixWriter.CreateDataMatrix("LOT-4471-A", 200, EciMode.ForceUtf8);
  • GeneratedBarcode standard = DataMatrixWriter.CreateDataMatrix("LOT-4471-B", 200);

Code Explanation

We first import the IronBarcode library and set BarcodeWriter.DefaultEciMode to EciMode.Auto, the application-wide policy under which a header is written only when the data needs one.

The first CreateDataMatrix call passes EciMode.ForceUtf8 as its third argument. A per-call value wins over the static default, so this symbol carries the UTF-8 ECI header even though its payload is pure ASCII. The override applies to that call alone and leaves the application policy untouched.

The second call passes no encoding argument. It falls back to DefaultEciMode, so its ASCII payload produces the smaller untagged symbol. Only DataMatrixWriter.CreateDataMatrix offers this per-call parameter; QR, Aztec and PDF417 follow the static default instead.

Explore the full guide to controlling UTF-8 ECI tagging!

Ready to Get Started?

Nuget Downloads 2,472,280Version:2026.10just released

Key in blue circle

Get your free 30-day Trial Key instantly

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronBarcode
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get a Quote, No Obligation
Your details will always be kept confidential.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Trusted by Millions of Engineers Worldwide
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.10

PM > Install-Package BarCode
nuget.org/packages/BarCode/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronBarCode"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.10

  1. Download and unzip IronBarCode to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronBarCode.dll"

Licenses from $999