We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Failed to load response data in Chrome response headers

Return pdf in memory stream using MVC

MemoryStream ms = new MemoryStream();
pdf1.Save(ms);
string downloadname = “filename.pdf”;

Response.AppendHeader(“Content-Disposition”, string.Format(“ATTACHMENT;filename={0}”, downloadname));
Response.BinaryWrite(ms.GetBuffer());


Hi Rollyh,


Thanks for your inquiry. I have tested the scenario using following code with Aspose.Pdf for .NET 10.7.0 and unable to notice any exception with Chrome, We will appreciate it if you please share some more details a about the issue and also share a sample project to replicate the issue at our end. So we will investigate it further and provide you information accordingly.

Aspose.Pdf.Document
pdf;<o:p></o:p>

HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();

htmlLoadOptions.PageInfo.Width = 800;

htmlLoadOptions.PageInfo.Height = 600;

htmlLoadOptions.PageInfo.Margin.Left = 0;

htmlLoadOptions.PageInfo.Margin.Right = 0;

MemoryStream outputstream = new MemoryStream();

htmlLoadOptions.InputEncoding = "UTF-8";

using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(pageSource)))

{

pdf = new Document(stream, htmlLoadOptions);

}

pdf.Save(outputstream);

string downloadname = "filename.pdf";

Response.AppendHeader("Content-Disposition", string.Format("ATTACHMENT;filename={0}", downloadname));

Response.BinaryWrite(outputstream.GetBuffer());


Best Regards,