I'm using wkhtmltopdf to generate some pdfs from a asp.net mvc site. I'm using code found on another SO question here. There is a problem with this code in that there is a hard coded 60 second wait for the process to complete. I think it would be much improved if we could simply have a trigger or signal to watch for then exit and read the output. So does anyone know of a way to listen for a response from the wkhtmltopdf process?
// read the output here...
string output = p.StandardOutput.ReadToEnd();
// ...then wait n milliseconds for exit (as after exit, it can't read the output)
p.WaitForExit(60000);
// read the exit code, close process
int returnCode = p.ExitCode;
p.Close();