Presently utilizing
https://github.com/stranger82/angular-utf8-base64
as well as
https://github.com/eligrey/FileSaver.js/
for the purpose of decoding a base64 encoded PDF file that I am fetching from a rest API.
It successfully decodes and downloads, however when attempting to view it, it shows up as blank.
I have researched
AngularJS: Display blob (.pdf) in an angular app
and attempted adding
responseType: 'arraybuffer'
to my get request but this results in the response being null with no data returned from the get request.
Other files download and render correctly without issues.
Any assistance would be greatly appreciated!
Code:
function save() {
var fileContent = base64.decode(response.File.fileContent);
var file = new Blob([fileContent], {type: response.File.contentType});
saveAs(file, response.File.name);
}
$http.get(url.join('')).success(function(response) {
save(response);
}).error(function(error) {
console.log('The following error has occurred' + error);
});