We are using wkhtmltopdf.exe (up to 10 months it had been worked with no issues) but from few days we are facing issue with wkhtmltopdf.exe. For now we are getting error from wkhtmltopdf.exe and PDF is not generating for us, we use JavaScripts. When I click page is going to our written error page. Our problem in PDF is not coming with any versions from wkhtmltopdf.exe. Our code and applications are very clear .wkhtmltopdf.exe is working in local why not in live server(Windows 2008 R2 enterprise)? We had tried all the versions from (wkhtmltopdf site)[http://wkhtmltopdf.org/downloads.html] all were worked in localhost but not in live server.our local server iis version is (7.5) is same as in live server is about iis version(7.5) what to do next ?? in localhost pdf is generating with iis version is (7.5) having same version in Windows server 2008 R2 enterprise but PDF is not generating.
protected void Export(object sender, EventArgs e)
{
String GlobalDomainName = System.Configuration.ConfigurationManager.AppSettings["live_domainName"];
string url = "PropertyEWC.aspx?id=" + PropertyId + "&bid=" + UserData.BranchId + "&aid=" + UserData.CompanyId;
string args = string.Format("\"{0}\" - ", GlobalDomainName + url);
var startInfo = new ProcessStartInfo("C:\\Program Files\\wkhtmltopdf1\\bin\\wkhtmltopdf.exe", args)
{
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true
};
var proc = new Process { StartInfo = startInfo };
proc.Start();
string output = proc.StandardOutput.ReadToEnd();
byte[] buffer = proc.StandardOutput.CurrentEncoding.GetBytes(output);
proc.WaitForExit();
proc.Close();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment;filename=ElectronicWindow.pdf");
Response.BinaryWrite(buffer);
Response.End();
}
In above code we are getting error in proc.start() what to do for solving the error is their any alternative method for proc.start.
It Works for me by doing changes in wkhtmltopdf.exe properties. Right Click ur mouse on wkhtmltopdf.exe,select properties In properties select security option. In that u can change ur Access options.