Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created March 15, 2023 18:17
Show Gist options
  • Save bjoerntx/ca57f8e314a15705c8a2420e976ba5b7 to your computer and use it in GitHub Desktop.
Save bjoerntx/ca57f8e314a15705c8a2420e976ba5b7 to your computer and use it in GitHub Desktop.
[HttpPost]
public string ExportPDF([FromBody] TXTextControl.Web.MVC.DocumentViewer.Models.SignatureData data) {
byte[] bPDF;
// create temporary ServerTextControl
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) {
tx.Create();
// load the document
tx.Load(Convert.FromBase64String(data.SignedDocument.Document), TXTextControl.BinaryStreamType.InternalUnicodeFormat);
FlattenFormFields(tx);
// save the document as PDF
tx.Save(out bPDF, TXTextControl.BinaryStreamType.AdobePDFA);
}
return Convert.ToBase64String(bPDF);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment