Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active September 6, 2021 09:51
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/d98cdf77a1c40d45df751b39a6f4262c to your computer and use it in GitHub Desktop.
Save bjoerntx/d98cdf77a1c40d45df751b39a6f4262c to your computer and use it in GitHub Desktop.
[HttpPost]
public JsonResult CreateForm(string document) {
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) {
tx.Create();
tx.Load(Convert.FromBase64String(document),
TXTextControl.BinaryStreamType.InternalUnicodeFormat);
List<FormSection> formSections = new List<FormSection>();
foreach (TXTextControl.SubTextPart section in tx.SubTextParts) {
byte[] data;
section.Save(out data, BinaryStreamType.InternalUnicodeFormat);
var fields = GetFormFields(data);
formSections.Add(new FormSection() {
Name = section.Name,
FormFields = fields
});
}
return Json(formSections, JsonRequestBehavior.AllowGet);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment