I'm currently using the NReco phantomjs wrapper and all is well. I call an existing JavaScript file and use a stream to pass in data and an output stream to get the results which I can then turn in to a PNG and insert it into a document.
The code looks a bit like:
using (var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(serialisedJsonData + "\n")))
using (var outputStream = new MemoryStream())
{
var phantomJS = new PhantomJS();
phantomJS.Run("javascriptfile.js", null, inputStream, outputStream);
...
}
I would ideally like to call the run method async but I there doesn't seem to be a way to do this with the input and output streams (only with the script filename and args).
Am I missing something or is this not possible?