function downPdf(val, fileName) { fetch(val) .then(respose => { return respose.blob() }) .then(blob => { console.log(val) const url = URL.createObjectURL(blob) const a = document.createElement('a') const name = fileName ? fileName : val.substr(val.lastIndexOf('/') + 1, val.length) a.href = url a.download = name a.click() }) } export default downPdf