You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
418 B
17 lines
418 B
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
|
|
|