We're using Reporting Services to generate a PDF report and we need it to be rendered out to the browser window AND embedded in the browser. We've been doing this a long time and it has always worked ... until IE9.
In IE6, IE7, and IE8, we generate the byte array from Reporting Services that represents the PDF report and binary write it out to the browser, and everything works great. The PDF displays embedded in the browser.
In IE9, we try the same exact thing and the PDF is NOT embedded in the browser window. The browser window stays open and is blank/empty, and the PDF is opened in Adobe Reader in a separate window.
Here's a snippet of our code:
try
{
// Set all the Reporting Services variables and parameters and render the report
// ...
byte[] result = rs.Render(format, devInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);
// Force the render out of the report to the browser
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AppendHeader("content-length", result.Length.ToString());
Response.AppendHeader("Pragma", "cache");
Response.AppendHeader("Expires", "3600");
Response.Buffer = true;
Response.Cache.SetCacheability(HttpCacheability.Private);
Response.CacheControl = "private";
Response.Charset = System.Text.UTF8Encoding.UTF8.WebName;
Response.ContentEncoding = System.Text.UTF8Encoding.UTF8;
switch (outputformat)
{
case "PDF":
Response.AppendHeader("content-disposition", "inline; filename=report.pdf");
Response.ContentType = "application/pdf";
break;
default:
break;
}
Response.BinaryWrite(result);
Response.Flush();
Response.Close();
Response.End();
}
catch (System.Exception ex)
{
// ...
}
What can we do to get the PDF rendered and embedded in the IE9 broswer window?
Thanks!