Created
April 30, 2024 16:04
-
-
Save bjoerntx/11ac12cc70e41b6037dfba8cdf4b7007 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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