Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. byte[] byteSI = p.GenerateReportBinary();
  2.  
  3. //2.
  4. string filename = Server.MapPath("~/Temp/SI_TermTakaful.pdf");
  5. File.WriteAllBytes(filename, byteSI);
  6.  
  7. Session["PdfUrl"] = byteSI;
  8.  
  9. ScriptManager.RegisterStartupScript(this, GetType(), "Show Modal Popup", "showmodalpopup();", true);
  10.  
  11. if (Session["PdfUrl"] != null)
  12. {
  13. string filename = Session["PdfUrl"].ToString();
  14.  
  15. Context.Response.Buffer = false;
  16. FileStream inStr = null;
  17. byte[] buffer = new byte[1024];
  18. long byteCount; inStr = File.OpenRead(filename);
  19. while ((byteCount = inStr.Read(buffer, 0, buffer.Length)) > 0)
  20. {
  21. if (Context.Response.IsClientConnected)
  22. {
  23. Response.ContentType = "application/pdf";
  24. Context.Response.OutputStream.Write(buffer, 0, buffer.Length);
  25. Context.Response.Flush();
  26. }
  27. }
  28.  
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement