summaryrefslogtreecommitdiff
path: root/contrib/barcode/barcode.go
diff options
context:
space:
mode:
authorRuud Kamphuis <ruudk@mphuis.com>2016-12-27 13:46:03 +0100
committerKurt Jung <kurt.w.jung@gmail.com>2016-12-27 07:46:03 -0500
commita1764391c7954b6bf5f49d09d4a5a32924e74dc9 (patch)
tree6763e6a9167de39e3346a5413c360fdacef0f684 /contrib/barcode/barcode.go
parent81e1e93b509dd8fc2775e37e5a6e1f416285a66f (diff)
Add support for Aztec barcodes (#101)
* Add RegisterAztec * Add test for RegisterAztec
Diffstat (limited to 'contrib/barcode/barcode.go')
-rw-r--r--contrib/barcode/barcode.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/barcode/barcode.go b/contrib/barcode/barcode.go
index 0649564..63a4908 100644
--- a/contrib/barcode/barcode.go
+++ b/contrib/barcode/barcode.go
@@ -21,6 +21,7 @@ import (
"bytes"
"errors"
"github.com/boombuler/barcode"
+ "github.com/boombuler/barcode/aztec"
"github.com/boombuler/barcode/codabar"
"github.com/boombuler/barcode/code128"
"github.com/boombuler/barcode/code39"
@@ -110,6 +111,15 @@ func Register(bcode barcode.Barcode) string {
return key
}
+// RegisterAztec registers a barcode of type Aztec to the PDF, but not to
+// the page. Use Barcode() with the return value to put the barcode on the page.
+// code is the string to be encoded. minECCPercent is the error correction percentage. 33 is the default.
+// userSpecifiedLayers can be a value between -4 and 32 inclusive.
+func RegisterAztec(pdf barcodePdf, code string, minECCPercent int, userSpecifiedLayers int) string {
+ bcode, err := aztec.Encode([]byte(code), minECCPercent, userSpecifiedLayers)
+ return registerBarcode(pdf, bcode, err)
+}
+
// RegisterCodabar registers a barcode of type Codabar to the PDF, but not to
// the page. Use Barcode() with the return value to put the barcode on the page.
func RegisterCodabar(pdf barcodePdf, code string) string {