I tried this in jsFiddle, and it works well in Chrome & FF, need to check on other browsers as well.
Convert the byte[]
to Base64
using,
string base64PDF = System.Convert.ToBase64String(outputPDF, 0, outputPDF.Length);
All I had to do is specify the MIME type
as data:application/pdf;base64,
in the source and give the Base64
version of the PDF
.
<object data="data:application/pdf;base64, JVBERi0xLjQKJeLjz9MKMyA..." type="application/pdf" width="160px">
<embed src="data:application/pdf;base64, JVBERi0xLjQKJeLjz9MKMyA..." type="application/pdf" />
</object>
I couldn't be able to hide the top toolbar which appears in FF by appending #toolbar=0&navpanes=0&statusbar=0
.
IE8 needs a saved pdf file to be displayed.