I am using wkhtmltopdf
to convert HTML page to PDF in ASP.NET. The following is my coding
protected void Button_Click(object sender, EventArgs e)
{
Process p = new Process();
p.StartInfo = new ProcessStartInfo();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = Server.MapPath("~/wkhtmltopdf/wkhtmltopdf.exe");
string arguments = "\"" + "http://localhost:51528/settings/InvoiceStatementPrint.aspx?InvoiceID=48\"" + " " + Server.MapPath("~/settings/" + "InvoiceDetail_1.pdf");
p.StartInfo.Arguments = arguments;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.WaitForExit();
p.Close();
p.Dispose();
}
The URL creates proper page. But InvoiceDetail_1.pdf
generates black page PDF. Is there is any thing wrong in my code?