-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextControlProcessing.cs
More file actions
36 lines (26 loc) · 921 Bytes
/
TextControlProcessing.cs
File metadata and controls
36 lines (26 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using LiteDB;
using Newtonsoft.Json;
using System.Text;
namespace tx_wp_api {
public class TextControlProcessing {
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);
}
}
}