Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created October 30, 2023 13:39
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/57797b20b02d1f95dc53df0c9e7f6143 to your computer and use it in GitHub Desktop.
Save bjoerntx/57797b20b02d1f95dc53df0c9e7f6143 to your computer and use it in GitHub Desktop.
private Envelope ExtractEnvelopeFromPDF(byte[] document)
{
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
var loadSettings = new TXTextControl.LoadSettings
{
EmbeddedFiles = new EmbeddedFile[] { },
};
tx.Load(document, TXTextControl.BinaryStreamType.AdobePDF, loadSettings);
var embeddedFile = loadSettings.EmbeddedFiles
.FirstOrDefault(ef => ef.FileName.StartsWith("tx-hash_"));
if (embeddedFile != null)
{
return JsonConvert.DeserializeObject<Envelope>(Encoding.UTF8.GetString((byte[])embeddedFile.Data));
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment