barcodes/generation/aztec.go

29 lines
482 B
Go
Raw Normal View History

2023-09-01 20:50:47 +01:00
package generation
import (
"fmt"
"github.com/boombuler/barcode"
"github.com/boombuler/barcode/aztec"
)
func generateAztec(parameters Parameters) (barcode.Barcode, error) {
var level uint8
switch parameters.ECCLevel {
case 1:
level = 7
case 2:
level = 15
case 3:
level = 25
case 4:
level = 30
}
aztecCode, err := aztec.Encode([]byte(parameters.Content), int(level), 0)
if err != nil {
fmt.Println("Error creating Barcode", err)
}
return aztecCode, err
}