Thanks very much @alcampopiano, you’ve been immensely helpful. This approach works fine, but for some reason, it doesn’t work with the base64 string of the svg file created with the
generate_barcode() function
I found another fix by drawing the image on a canvas to the required dimension, and using:
get_image()on the canvas element to get the drawn image in png format, and setting the url of the image (which is a base64 string) as the source of my image in html. This works fine!!!