Implement EAN and improve Code39 error handling
This commit is contained in:
20
generation/ean.go
Normal file
20
generation/ean.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package generation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/boombuler/barcode"
|
||||
"github.com/boombuler/barcode/ean"
|
||||
)
|
||||
|
||||
func generateEAN(parameters Parameters) (barcode.Barcode, error) {
|
||||
var strippedBarcode barcode.Barcode
|
||||
GeneratedBarcode, err := ean.Encode(parameters.Content)
|
||||
if err != nil {
|
||||
fmt.Println("Error creating Barcode", err)
|
||||
} else {
|
||||
strippedBarcode = GeneratedBarcode.(barcode.Barcode)
|
||||
}
|
||||
|
||||
return strippedBarcode, err
|
||||
}
|
||||
Reference in New Issue
Block a user