Image placeholders
Merge a data-bound image
Create the report to decode the Base64 logo in the JSON and place it into the named image object in the template.
Binary contentReplace a named image
Base64 data changes the content while the template preserves size and layout.
Base64PlaceholderNamed image
PayloadBase64 JSON
GeometryPreserved
Empty valuesRemoved
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
Keep image layout under designer control
A template image can be named like a data column. During the merge, its binary content is replaced while size, text wrapping, anchoring, and surrounding layout remain defined by the template.
The sample carries the image as a Base64 string in JSON, making the data source self-contained and independent of public image URLs.
API used
MailMerge.RemoveEmptyImages
Key members
RemoveEmptyImages cleans up unresolved image placeholders while matching Base64 values replace named template images.
using var mailMerge = new MailMerge
{
TextComponent = textControl,
RemoveEmptyBlocks = true,
RemoveEmptyImages = true
};
mailMerge.LoadTemplate(templatePath, FileFormat.InternalUnicodeFormat);
mailMerge.MergeJsonData(File.ReadAllText(dataPath));
How it works
MailMerge decodes the matching JSON value and replaces the placeholder image. RemoveEmptyImages also prevents unresolved placeholders from remaining in generated documents.
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