Barcode placeholders
Generate barcodes from data
Merge the report to replace each named barcode placeholder with the corresponding serial value from the JSON data.
Document objectsPopulate configured barcodes
The template controls symbology and geometry; JSON supplies only encoded values.
BarcodeDesignTemplate object
ValueJSON field
PlacementMerge block
OutputLive barcode
Template structureUnderstand the current template
Explore its merge fields, repeating blocks, and nested structure in an interactive template map.
Inspector
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Separate barcode design from barcode value
The template defines each barcode's symbology, dimensions, alignment, and position. The data source supplies only the content encoded by that placeholder.
Because barcodes are document objects, they participate in the same repeating blocks as product names, prices, and other merge fields.
API used
MailMerge.MergeJsonData
Key members
Named barcode objects receive their encoded values during the same MergeJsonData operation as ordinary fields and blocks.
using var textControl = new ServerTextControl();
textControl.Create();
using var mailMerge = new MailMerge
{
TextComponent = textControl,
RemoveEmptyBlocks = true
};
mailMerge.LoadTemplate(templatePath, FileFormat.InternalUnicodeFormat);
mailMerge.MergeJsonData(File.ReadAllText(dataPath));
mailMerge.SaveDocumentToMemory(
out byte[] document,
BinaryStreamType.InternalUnicodeFormat,
new SaveSettings());
How it works
The controller merges the JSON into a template containing named barcode objects. Matching data values update those objects while their visual settings remain unchanged.
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Displays supported document and PDF formats in the browser.
dotnet add package TXTextControl.Web.DocumentViewer --version 34.2.0