I would add an image to a pdf File.
const pdf = new jsPDF('l', 'px', 'a4');
const imgData = 'data:image/jpeg;base64,' + btoa(`assets/img/brand/png/Logos.png`);
console.log(imgData);
pdf.addImage(imgData, 'jpeg', 15, 40, 180, 160);
pdf.save(`ind.pdf`);
I get an error
Error: addImage does not support files of type 'UNKNOWN'
I think that the error comes from btoa()
it encode the path string but not the file.
How can I pass to btoa the png image instead of the path string ?