protected void btnExportToExcel_Click(object sender, EventArgs e) { WorkingWay3(); } private void WorkingWay3() { string pdfExportPath = profile + ApConfig.CurrentCompany.CompId + "/" + ApConfig.CurrentUser.EmpId.ToString(); if (!Directory.Exists(Server.MapPath(pdfExportPath))) { Directory.CreateDirectory(Server.MapPath(pdfExportPath)); } else { pdfExportPath = pdfExportPath + "/Objectives.pdf"; } string objpath = Server.MapPath(pdfExportPath); HtmlToPdf("http://localhost:32370/User/PerformancePDF.aspx", @"D:/Projects/New.pdf"); Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=DownloadedFile.zip"); Response.ContentType = "application/zip"; objZip.Save(Response.OutputStream); Response.End(); } private void HtmlToPdf(string website, string destinationFile) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardInput = true; startInfo.RedirectStandardError = true; startInfo.CreateNoWindow = true; startInfo.FileName = "C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe"; startInfo.Arguments = website + " " + destinationFile; Process myProcess = Process.Start(startInfo); myProcess.WaitForExit(); myProcess.Close(); objZip.AddFile(destinationFile, "Files"); }