I receive pdf in base64 format. when i open it using window.open() pdf download,but name of pdf is download.pdf. i want to custom name that pdf file. Thanks in advance.
fetch(service_url, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
}).then(response => response.blob())
.then(response => {
var blob=response
var reader = new window.FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function() {
var base64data = reader.result;
window.open(base64data);
}
})
.catch(error => {
console.error(error);
});