Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created August 16, 2019 09:40
Show Gist options
  • Save bjoerntx/a4393531126bc04387676391f3bea50e to your computer and use it in GitHub Desktop.
Save bjoerntx/a4393531126bc04387676391f3bea50e to your computer and use it in GitHub Desktop.
private void MergeDocument(string Filename, object Data)
{
// create a new PassingObject that is used to send
// data to the ProcessingApplication using pipes
PassingObject dataObject = new PassingObject()
{
Data = JsonConvert.SerializeObject(Data),
Document = File.ReadAllBytes(Filename)
};
// call the processing app and pass the data object
ReturningObject returnObject = ParallelProcessing.CallProcessingApp(dataObject);
// create destination folder if it doesn't exists
Directory.CreateDirectory(sResultsFolder);
// write the returned byte array as a file
File.WriteAllBytes(sResultsFolder + "\\" +
Path.GetFileNameWithoutExtension(Filename) +
".pdf", returnObject.Document);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment