Created
June 24, 2021 14:10
-
-
Save bjoerntx/e9d334048915b194cec488d5e2521252 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 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