boombuler / barcode

a barcode creation lib for golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can the generated bar code be returned as a byte array?

MichaelLiss opened this issue · comments

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

Hi,

the returned barcode is an Image which you could save as png with "image/png" or similar...

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)