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.