Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created June 10, 2023 20:48
Show Gist options
  • Save bjoerntx/fedcfcaa987f5614f5fbe6053b78217d to your computer and use it in GitHub Desktop.
Save bjoerntx/fedcfcaa987f5614f5fbe6053b78217d to your computer and use it in GitHub Desktop.
public byte[] ExtractSmartDocument(string DocumentName) {
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) {
tx.Create();
// the load PDF document
TXTextControl.LoadSettings loadSettings = new LoadSettings();
tx.Load(DocumentName,
TXTextControl.StreamType.AdobePDF,
loadSettings);
// loop through all attachments to find the original document
// and the annotations
foreach (EmbeddedFile file in loadSettings.EmbeddedFiles.Reverse()) {
if (file.FileName == "original.tx")
return (byte[])file.Data;
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment