Created
October 30, 2023 13:39
-
-
Save bjoerntx/57797b20b02d1f95dc53df0c9e7f6143 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
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