A barcode creation lib for golang (evacuated from NSA/Microsoft Github)
Florian 3c06908149 Merge pull request #37 from logic/intrune-tests | 6 gadi atpakaļ | |
---|---|---|
aztec | 7 gadi atpakaļ | |
codabar | 6 gadi atpakaļ | |
code128 | 7 gadi atpakaļ | |
code39 | 7 gadi atpakaļ | |
code93 | 7 gadi atpakaļ | |
datamatrix | 7 gadi atpakaļ | |
ean | 7 gadi atpakaļ | |
pdf417 | 7 gadi atpakaļ | |
qr | 7 gadi atpakaļ | |
twooffive | 7 gadi atpakaļ | |
utils | 6 gadi atpakaļ | |
.gitignore | 7 gadi atpakaļ | |
LICENSE | 10 gadi atpakaļ | |
README.md | 7 gadi atpakaļ | |
barcode.go | 7 gadi atpakaļ | |
scaledbarcode.go | 7 gadi atpakaļ |
This is a package for GO which can be used to create different types of barcodes.
This is a simple example on how to create a QR-Code and write it to a png-file
package main
import (
"image/png"
"os"
"github.com/boombuler/barcode"
"github.com/boombuler/barcode/qr"
)
func main() {
// Create the barcode
qrCode, _ := qr.Encode("Hello World", qr.M, qr.Auto)
// Scale the barcode to 200x200 pixels
qrCode, _ = barcode.Scale(qrCode, 200, 200)
// create the output file
file, _ := os.Create("qrcode.png")
defer file.Close()
// encode the barcode as png
png.Encode(file, qrCode)
}
See GoDoc
To create a barcode use the Encode function from one of the subpackages.