2021年4月6日星期二

How can i download my file pdf, with another name?

i want to download my file pdf so i am using this library file-saver + reactjs

to download i use this function

saveAs(urlApi, "file.pdf")  

you can see this documentation https://www.npmjs.com/package/file-saver but dont worked

the urlApi is like this: https://api.amazon.com/v1/down/10/78Jw/7aaspay4564654587.pdf i want to rename to file.pdf

when i did this:

const  blob = new Blob([urlApi], {type: "text/plain;charset=utf-8"});  saveAs(blob, 'file.pdf')  

download with the file.pdf name but when i try to open i get this error in the browser: failed to load pdf document blob javascript

https://stackoverflow.com/questions/66978936/how-can-i-download-my-file-pdf-with-another-name April 07, 2021 at 10:49AM

没有评论:

发表评论