Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active February 10, 2021 16:08
Show Gist options
  • Save bjoerntx/dd0ede2d9820a0addf1ec051151b66fb to your computer and use it in GitHub Desktop.
Save bjoerntx/dd0ede2d9820a0addf1ec051151b66fb to your computer and use it in GitHub Desktop.
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) {
tx.Create();
tx.Selection.FontSize = 800;
tx.Selection.Text = "Sample Form\r\n\r\n";
tx.Selection.FontSize = 400;
tx.Selection.Text = "Company name:\r\n";
// add a text form field
TXTextControl.TextFormField textFormField = new TXTextControl.TextFormField(1000);
textFormField.Name = "company_name";
textFormField.Text = "Text Control, LLC";
tx.FormFields.Add(textFormField);
tx.Selection.Text = "\r\n\r\nCountry:\r\n";
// add a text form field
TXTextControl.SelectionFormField selectionFormField = new TXTextControl.SelectionFormField(1000);
selectionFormField.Name = "company_country";
selectionFormField.Items = new string[] { "United States", "Germany", "Italy" };
selectionFormField.SelectedIndex = 0;
tx.FormFields.Add(selectionFormField);
// export the document as PDF
tx.Save("results.pdf", TXTextControl.StreamType.AdobePDF);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment