I have a small problem that puzzles over this problem. I have an ajax call that should display an iframe that loads a PDF file. PDF is created using Apache FOP hosted in a different environment. What I still have:
in the controller action (where is the src element of the iFrame points), a piece of code:
var targetStream = new MemoryStream();
using (var response = FOPrequest.GetResponse())
{
using (var stream = response.GetResponseStream())
{
stream.CopyTo(targetStream);
}
}
return new FileStreamResult(targetStream, "application/pdf");
However, this does not work properly. The stream fills as expected, but the PDF does not display in the iFrame. I get an Http 200 response code (OK).
I would be grateful for any help.
source
share