Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created February 21, 2022 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/6175249cfc08c03e1cd1d5bc19b771f3 to your computer and use it in GitHub Desktop.
Save bjoerntx/6175249cfc08c03e1cd1d5bc19b771f3 to your computer and use it in GitHub Desktop.
HealthcareForm data = new HealthcareForm() {
insurance_date = new DateTime(2020,1,1),
insurance_name = "Health Providers",
insurance_check = true,
insurance_state = "Georgia",
notes = "Thanks for your business."
};
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) {
tx.Create();
tx.Load("App_Data/health_form.tx", TXTextControl.StreamType.InternalUnicodeFormat);
using (MailMerge mm = new MailMerge()) {
mm.TextComponent = tx;
mm.FormFieldMergeType = FormFieldMergeType.Replace;
mm.MergeObject(data);
}
// save document as PDF
byte[] document;
tx.Save(out document, TXTextControl.BinaryStreamType.AdobePDF);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment