What I’m trying to do:
I want to generate a barcode as an image and show this on a form
What I’ve tried and what’s not working:
I have created a server function that generates an image for a given EAN code (using pyBarcode module which is standard on board in Anvil. However, rendering it as an image does not work (BytesIO())
Code Sample:
import barcode
from barcode.writer import SVGWriter
import IO
@anvil.server.callable
def show_barcode(code):
return_value = IO.BytesIO()
ean = barcode.get(‘ean13’, code, writer=SVGWriter()).write(return_value)
return ean```
Clone link:
share a copy of your app