This is a migrated thread and some comments may be shown as answers.

Page not Refreshing after downloading PDF file

0 Answers 167 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Venkateswarlu
Top achievements
Rank 1
Venkateswarlu asked on 04 Jul 2013, 06:39 AM
Hi,

After Downloading the PDF file the Current page not Refreshing.


 already i have used the following code, but not working

            Image PreviewImg = (Image)Session["CheckPreviewImage1"];
            Document PDFPageSize = new Document(PageSize.A3);
            string FileName = "Some FileName";

            string path = Server.MapPath("PrintCheckPDFfiles") + "\\" + FileName + ".pdf"; ;
            PdfWriter.GetInstance(PDFPageSize, new FileStream(path, FileMode.OpenOrCreate));
            PDFPageSize.Open();
            iTextSharp.text.Image pdfimg = iTextSharp.text.Image.GetInstance(PreviewImg, System.Drawing.Imaging.ImageFormat.Gif);
            PDFPageSize.Add(pdfimg);
            PDFPageSize.Close();

            byte[] bytes = File.ReadAllBytes(path);
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ".pdf");
            //Response.Buffer = true;
            Response.Charset = "";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.BinaryWrite(bytes);
            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.End();

            Response.Redirect("PageName.aspx");
  
             for Refreshing the page after last line i used the above statement( Response.Redirect("PageName.aspx");)



No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Venkateswarlu
Top achievements
Rank 1
Share this question
or