Created
September 1, 2023 10:26
-
-
Save bjoerntx/fb1b8da73d69b7b86fd94b60f1637a73 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 Merge(ProcessingRequest request) { | |
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) { | |
tx.Create(); | |
// create document or use MailMerge to generate larger document | |
tx.Text = "My created document."; | |
byte[] data; | |
tx.Save(out data, TXTextControl.BinaryStreamType.AdobePDF); | |
request.StoreDocument(data); | |
} | |
request.Processed = true; | |
request.Update(); | |
Task.Run(() => FireAndForgetWebHook(request)); | |
} | |
private static void FireAndForgetWebHook(ProcessingRequest request) { | |
HttpClient client = new HttpClient(); | |
var json = JsonConvert.SerializeObject(request); | |
var data = new StringContent(json, Encoding.UTF8, "application/json"); | |
client.PostAsync(request.WebHookUrl, data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment