package generation import ( "fmt" "github.com/boombuler/barcode" "github.com/boombuler/barcode/pdf417" ) func generatePDF417(parameters Parameters) (barcode.Barcode, error) { var level uint8 switch parameters.ECCLevel { case 1: level = byte(1) case 2: level = byte(3) case 3: level = byte(5) case 4: level = byte(8) } pdf417Code, err := pdf417.Encode(parameters.Content, level) if err != nil { fmt.Println("Error creating Barcode", err) } return pdf417Code, err }