i would like to create a function which converts an image from a website to pdf and serves it as download by pressing a button. The image is created by a python cgi script depending on users input. The address of the image is a base64 encoded string which will change depending on users request. E.g:
<img src='data:image/png;base64,iVBORw0KGgoAAAAN....='/>
I have found this piece of code.
var imgData = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD...';
var doc = new jsPDF();
doc.addImage(imgData, 'JPEG', 15, 40, 180, 180);
In this example you have to know the string already. Is there a way to make java script read out the image address and save it in variable like above?
Thanks for your help.