I am creating a PDF using a response object. The code does display HTML in PDF. PDF generation time is not fixed, so I want to show the preloader process (processing / loading) during this time using Ajax.
When I start the PDF creation process when I click the button, it will start the preloader process, but after the PDF creation is complete, the preloader process will not be stopped.
Also, suppose I want to clear data in text blocks on a page, then this is not cleared.
What do I need to do to solve these problems.
Here is the 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)
source share