Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created June 24, 2021 14:10
Show Gist options
  • Save bjoerntx/e9d334048915b194cec488d5e2521252 to your computer and use it in GitHub Desktop.
Save bjoerntx/e9d334048915b194cec488d5e2521252 to your computer and use it in GitHub Desktop.
public static void SaveDocument(SmartDocument smartDocument) {
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) {
tx.Create();
// load the edited document
tx.Load(Convert.FromBase64String(smartDocument.Document),
TXTextControl.BinaryStreamType.InternalUnicodeFormat);
// create an attachment from the edited document
EmbeddedFile embeddedFile = new EmbeddedFile("original.tx",
Convert.FromBase64String(smartDocument.Document),
null);
embeddedFile.Relationship = "Source";
// attache the files
TXTextControl.SaveSettings saveSettings = new TXTextControl.SaveSettings() {
EmbeddedFiles = new EmbeddedFile[] { embeddedFile }
};
// save the document as PDF with the edited original attachment
tx.Save("App_Data/" + smartDocument.Name,
TXTextControl.StreamType.AdobePDF,
saveSettings);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment