Ah, that is another topic completely, and not one I'm very well versed on, unfortunately.
I saw this post here
And you could try it yourself, the free version of the tool has 250 conversions per month, and you could convert any type of images to pdf using a simple post operation (doc here
POST https://v2.convertapi.com/convert/images/to/pdf \
 -H "Authorization: Bearer api_token" \
 -F "Files[0]=@/path/to/my_file.png"
However, I'm sure other people from the forum may be able to help with proper code to achieve what you need. With the above, you could hit the api, which would return the file data, which you can then store in yoru retool database.