I m using wkhtmltopdf for creating pdf in a console application c#.net
The following is the code and
psi.UseShellExecute = false;
psi.FileName = "C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe";
psi.CreateNoWindow = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.Arguments = "--enable-javascript --no-stop-slow-scripts --javascript-delay 10000 --page-size A4 --dpi 300 --margin-top 20mm --header-html D:\\header.html --margin-bottom 10mm - --footer-html D:\\footer.html " + tempPath + "\\" + outFileName;
p = Process.Start(psi);
try
{
stdin = p.StandardInput;
stdin.AutoFlush = true;
stdin.Write(HTML);
stdin.Close();
p.WaitForExit(60000);
}
finally
{
p.Close();
p.Dispose();
}
I expect the wkhtmltopdf.exe to exit at waitforexit line
But I can still see it in the memory and pdf is created with 0kb
If I close my console application, the pdf is created properly
This issue happens only when I use header and footer html in the arguments, else it works fine.