let filename = "document.doc";
let downloadLink = document.createElement("a");
downloadLink.href = "data:application/vnd.ms-word;charset=utf-8," + encodeURIComponent(data);
downloadLink.download = filename;
downloadLink.click();
Currently we are using above code to create a .doc file with data
But we want to save this file as .pdf using React JS
When we replace the filename with filename.pdf it is showing error as
Failed to load PDF document