Hi I am working on a project where I save image files to Cloudinary. And store url of the image location and pass it to server side. From the server side I save the image urls to database. Then I have to generate a pdf with those images and send an email.(I am doing this through same api where I save image paths to database).
I am using jsPDF.
on front end I have a preview function where I could display cloudinary url of the image
doc.addImage(file, 'PNG', 198, 50, 110, 80, '', 'FAST', 90);
[here file is accessed through html element)
And this code works and can see the pdf preview of the image.
But when I try to do the same in server side
doc.addImage(e.image, 'PNG', 198, 50, 110, 80, '', 'FAST', 90);
this line gives a timeout and failure response to my api. If I comment this out it works pdf is created with no Image.(Both file and e.image are cloudinary image urls, images exists).
I need to create this pdf on server. I got the clue as that it takes time to load this image(which does not happen in preview function in front end) and according to google I need to convert it to base64.Now since I am in server is there a way I can convert my url to a base64 string. What I tried so far did not work. Or is there a better work around for this?.
Sending base64 through api is not possible because of file size problem and api object can have several images in one purchase.