I can generate the PDF file and save it successfully in the server, however, I don't want the newly created file to be opened on the current browser.
I am generating multiple files and mailing them at one go.
How do I stop the browser from opening the newly created file.
Response.ContentType = "application/pdf";
//Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
WholeForm.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 50f, 50f, 30f, 20f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
PdfWriter.GetInstance(pdfDoc, new FileStream("\\\\sever\\d$\\PDFs\\" + hdnFileName.Text + ".pdf", FileMode.Create));
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
pdfDoc.Dispose();
//SendEmail();
//Response.Write(pdfDoc);
//Response.End();