Created
February 21, 2022 21:26
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
// create the pre-populate data object | |
HealthcareForm data = new HealthcareForm() { | |
insurance_date = DateTime.Now, | |
insurance_name = "Global Health", | |
insurance_check = true, | |
insurance_state = "North Carolina", | |
notes = "Thanks for your business." | |
}; | |
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) { | |
tx.Create(); | |
// load the template | |
tx.Load("App_Data/health_form.tx", TXTextControl.StreamType.InternalUnicodeFormat); | |
using (MailMerge mm = new MailMerge()) { | |
mm.TextComponent = tx; | |
// pre-populate the form fields | |
mm.FormFieldMergeType = FormFieldMergeType.Preselect; | |
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