Can the generated bar code be returned as a byte array?
MichaelLiss opened this issue · comments
Mike Liss commented
Hi,
I have a requirement that the bar code be generated in memory and returned as a byte string.
Here is what I have... I don't know if "Content()" does what I think it does
bytes := []byte("hello world")
azCode, _ := aztec.Encode(bytes, aztec.DEFAULT_EC_PERCENT, aztec.DEFAULT_LAYERS)
azCode, _ = barcode.Scale(azCode, 40, 100)
retval := []byte(azCode.Content())
return retval
Florian commented
Hi,
the returned barcode is an Image which you could save as png with "image/png" or similar...
Mike Liss commented
Thank you for replying... but which one is correct?
( I don't need it in a PNG or other image type... I just need a byte string )
A
retval := []byte(azCode.Content())
or
B
retval := []byte(azCode)