I currently take a base 64 encoded string that represents a PDF file and convert it to a blob in AngularJS using the following code (simplified):
var base64PdfToBlob = function(b64Data: string, contentType: string) {
var sliceSize = 512;
var byteCharacters = atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
var blob = new Blob(byteArrays, { type: contentType });
return blob;
}
var pdfBlob = base64PdfToBlob(base64Pdf, "application/pdf");
var blobUrl = URL.createObjectURL(pdfBlob);
$scope.pdfDoc = $sce.trustAsResourceUrl(blobUrl);
I then embed the pdf in the html using the following code:
<object data="{{pdfDoc}}" type="application/pdf" width="100%" height="100%"></object>
This works in chrome, firefox, and safari. This does NOT work in Edge or IE11. I feel like I have tried everything with nothing working.
Things I have tried: 1. Playing with the embed and object tags. 2. Uninstalling and reinstalling adobe reader. Messing with the settings and configurations between adobe reader and IE. 3. Changing security settings in IE.
Doing an iFrame, new tab, new window, downloading pdf is not an option. The PDF must be embedded on the current page. Some documentation I am reading seems to state this is NOT possible in Edge but should work in IE.
My machine is Windows 10, 64 bit, IE11, Adobe Acrobat Reader DC 2015.017.20050