Add Code39
This commit is contained in:
parent
073737d0e7
commit
54fa0d34ad
18
generation/code39.go
Normal file
18
generation/code39.go
Normal file
@ -0,0 +1,18 @@
|
||||
package generation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/boombuler/barcode"
|
||||
"github.com/boombuler/barcode/code39"
|
||||
)
|
||||
|
||||
func generateCode39(parameters Parameters) (barcode.Barcode, error) {
|
||||
GeneratedBarcode, err := code39.Encode(parameters.Content, true, true)
|
||||
if err != nil {
|
||||
fmt.Println("Error creating Barcode", err)
|
||||
}
|
||||
|
||||
strippedBarcode := GeneratedBarcode.(barcode.Barcode)
|
||||
return strippedBarcode, err
|
||||
}
|
@ -29,6 +29,8 @@ func Generate(parameters Parameters) (barcode.Barcode, error) {
|
||||
barcode_content, err = generate2of5Interleaved(parameters)
|
||||
case TwoOfFive:
|
||||
barcode_content, err = generate2of5(parameters)
|
||||
case Code39:
|
||||
barcode_content, err = generateCode39(parameters)
|
||||
default:
|
||||
fmt.Println("Unsupported barcode type: ", parameters.Format)
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ const (
|
||||
PDF417 BarcodeType = "pdf417"
|
||||
TwoOfFive BarcodeType = "2of5"
|
||||
TwoOfFiveInterleaved BarcodeType = "2of5interleaved"
|
||||
Code39 BarcodeType = "code39"
|
||||
)
|
||||
|
||||
type ECCLevel int
|
||||
|
@ -41,13 +41,13 @@ var FormatRules = map[string]rule{
|
||||
divisible: 1,
|
||||
},
|
||||
|
||||
/* "code39": {
|
||||
"code39": {
|
||||
minLength: 1,
|
||||
maxLength: 80,
|
||||
charset: *CODE39,
|
||||
charset: *ASCII,
|
||||
divisible: 1,
|
||||
},
|
||||
*/
|
||||
|
||||
"code93": {
|
||||
minLength: 1,
|
||||
maxLength: 80,
|
||||
|
Loading…
Reference in New Issue
Block a user