I have a FileResult action that returns a PDF. I want to embed this PDF in an object tag. When I insert the action into the data attribute of the object tag, like below, no PDF is retrieved or shown in Chrome. (The PDF is shown in Firefox with the Adobe plugin - I don't care about IE.)
<object data="@Url.Action("GetPDF", "PDFCreation", new {id= Model.DocumentId})" type="application/pdf"></object>
It all works otherwise - the object tag works with a direct link to a PDF on the file system (e.g., data="~/Content/test.pdf"), and the Action above, if hard-pasted into the location bar, downloads the PDF.
Any thoughts? Thank you!
I managed to get IE to display a Pdf that was thrown back using a FileContentResult and the following object tag
<object>
<embed src="@Url.Action("GetPDF", "PDFCreation", new {id= Model.DocumentId})" type="application/pdf"></embed>
</object>
Might be worth a try
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With