Last active
January 7, 2021 22:00
-
-
Save bjoerntx/fcfcdbdb9c2bc13cec602e1b24de983a 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
[HttpPost] | |
public IActionResult Merge(Template template) { | |
// private OAuth settings | |
var os = new TXTextControl.DocumentServices.DocumentProcessing.OAuth.OAuthSettings( | |
"dsserver.EMRWLJ123pZirYLDNAF0gP7QzQaB8OfH", | |
"OGC24l8BcjVpc123Ht0gHJhDjtYJP70a"); | |
// create a new DocumentProcessing object with OAuth settings | |
DocumentProcessing s_dp = new DocumentProcessing("https://trial.dsserver.io", os); | |
// load the merge data from JSON text file | |
List<Report> journal = | |
JsonConvert.DeserializeObject<List<Report>>( | |
System.IO.File.ReadAllText("App_Data/data.json")); | |
// create a new MergeBody object with merge data and template | |
MergeBody mergeBody = new MergeBody() { | |
Template = Convert.FromBase64String(template.Document), | |
MergeData = journal | |
}; | |
// merge the document | |
var results = s_dp.Merge(mergeBody, ReturnFormat.TX).Result; | |
return Ok(results[0]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment