I used the below code to export to PDF format from my ASP.NET application.
However while opening the generated PDF file, it says the file has corrupted.
Please let me know if I coded anything wrong, or I need at add/remove any properties in the code, Or if there is any other reasons.
Response.Clear() Response.Buffer = True Response.ContentType = "application/pdf" Response.ContentEncoding = System.Text.Encoding.UTF7 Response.AddHeader("Content-Disposition", "attachment;filename=Estimates.pdf") Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.Charset = "" Me.EnableViewState = False Response.Write(objStrWriter.ToString()) Response.End()
In this code, objStrWriter is a StringWriter object which contains a HTML code as string.....