Base64 to pdf error: cannot download
Summary:
Hi experts
Content (required):
I am trying to download files from external database
and they are pdf. i used two different functions but non of them works. i tried two different cases. to use table and hyperlink. but non of them works too. latest download is text.
I am using a function1 :
download (blobData, contentType, fileName) {
var element = document.createElement('a');
element.setAttribute('href', this.preview(blobData, contentType));
element.setAttribute('download', fileName);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
};
I also used this function2:
PageModule.prototype.download = function (data) {
var bString = window.atob(data);