Preloader when creating a PDF using a response object

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) 
+4
source share
1 answer

do you use

 response.End(); 

If yes, then you need to do a text field cleanup and stop the bootloader before you call

 response.End(); 

Hope this helps. Remember to upgrade it if it solves your problem. Thanks..:)

+2
source

All Articles