Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created April 30, 2024 16:04
Show Gist options
  • Save bjoerntx/11ac12cc70e41b6037dfba8cdf4b7007 to your computer and use it in GitHub Desktop.
Save bjoerntx/11ac12cc70e41b6037dfba8cdf4b7007 to your computer and use it in GitHub Desktop.
public IActionResult Index()
{
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
tx.Load("App_Data/gpay_application.tx", TXTextControl.StreamType.InternalUnicodeFormat);
var jsonData = System.IO.File.ReadAllText("App_Data/data.json");
using (MailMerge mm = new MailMerge())
{
mm.TextComponent = tx;
mm.FormFieldMergeType = FormFieldMergeType.Preselect;
mm.MergeJsonData(jsonData);
}
byte[] data;
tx.Save(out data, TXTextControl.BinaryStreamType.InternalUnicodeFormat);
ViewBag.Document = Convert.ToBase64String(data);
}
return View();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment