I have a little problem getting my head around this problem. I have an ajax call that should render an iframe which loads a PDF. The PDF is generated using Apache FOP hosted in another environment. What I have so far is:
in the controller action (where the src element of the iFrame points), the code snippet is:
var targetStream = new MemoryStream();
using (var response = FOPrequest.GetResponse()) // response from FOP
{
using (var stream = response.GetResponseStream())
{
stream.CopyTo(targetStream);
}
}
return new FileStreamResult(targetStream, "application/pdf");
However, this does not work as expected. The stream is populated as expected, but the PDF does not render in the iFrame. I get a Http response code of 200 (OK).
I'd be grateful of any help.