Created
October 17, 2023 10:26
-
-
Save bjoerntx/154c9a13e0aff7c3ddb0d0ee78e7b38b 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() | |
{ | |
byte[] bDocument = null; | |
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.Editable = true; | |
tx.FormFields.Add(selectionFormField); | |
tx.InputPosition = new TXTextControl.InputPosition(-1, TXTextControl.TextFieldPosition.OutsideTextField); | |
tx.Selection.Text = "\r\n\r\nTaxable:\r\n"; | |
// add a text form field | |
TXTextControl.CheckFormField checkFormField = new TXTextControl.CheckFormField(false); | |
checkFormField.Name = "company_taxable"; | |
checkFormField.CheckedCharacter = 'X'; | |
checkFormField.UncheckedCharacter = 'O'; | |
tx.FormFields.Add(checkFormField); | |
// save in the internal format | |
tx.Save(out bDocument, TXTextControl.BinaryStreamType.AdobePDF); | |
tx.Save("test.pdf", TXTextControl.StreamType.AdobePDF); | |
} | |
return View(bDocument); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment