I am generating a PDF using the response object. The code actually renders the HTML to the PDF. PDF generation time is not fixed, so I want to show a preloader process (processing/loading) during this time using Ajax.
When I start the PDF generation process on button click, then it will start the preloader process, but after the completion of PDF getting generated, the preloader process is not getting stopped.
Also, suppose I want to clear the data in the textboxes on the page, then that is not getting cleared.
What do I need to do to solve these problems.
Here is code:
Dim Response As System.Web.HttpResponse = System.Web.HttpContext.Current.Response
Response.Clear()
Response.ClearHeaders()
Response.ClearContent()
Response.ContentType = "application/pdf"
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Me.txtReportSetPDFName.Text.Replace(" ", "_") + ".pdf")
Response.AppendHeader("Content-Length", FileLen(sFilePath).ToString)
Response.WriteFile(sFilePath)