I try to download a pdf (inserted in the folder of my project) at the click of the user. but when I download the file it says "operation failed"
function downloadFile() {
let link = document.createElement('a');
let file='data:application/pdf';
link.setAttribute('href',file);
link.download = 'l.pdf';
link.click();
}