We are using Aspose.PDF version 9.8.0 to create the PDF files programmatically in C#. The PDF file is generated successfully and managed to download through client browsers. When the document is accessed from server via client browser, the PDF document is rendering in browsers IE9, IE11 without any issues. But when accessing through Chrome browser, the document is not rendering and it keeps showing “Loading” message. Below is the code we use to send response to client browser,
MemoryStream stream = new MemoryStream(btImage);
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.Buffer = true;
Response.Charset = “UTF-8”;
Response.AddHeader(“Accept-Header”, stream.Length.ToString());
Response.AddHeader(“Content-Length”, stream.Length.ToString());
Response.AddHeader(“Expires”, “0″”);
Response.AddHeader(“Pragma”, “cache”);
Response.AddHeader(“Cache-Control”, “private”);
Response.AddHeader(“content-disposition”, String.Format(“inline;filename={0}”, “article” + docId + “.pdf”));
Response.ContentType = “application/pdf”;
Response.AddHeader(“Accept-Ranges”, “bytes”);
Response.BinaryWrite(stream.ToArray());
Response.Flush();
Response.End();