A barcode creation lib for golang (evacuated from NSA/Microsoft Github)
Florian 3c06908149 Merge pull request #37 from logic/intrune-tests | 6 年之前 | |
---|---|---|
aztec | 7 年之前 | |
codabar | 6 年之前 | |
code128 | 7 年之前 | |
code39 | 7 年之前 | |
code93 | 7 年之前 | |
datamatrix | 7 年之前 | |
ean | 7 年之前 | |
pdf417 | 7 年之前 | |
qr | 7 年之前 | |
twooffive | 7 年之前 | |
utils | 6 年之前 | |
.gitignore | 7 年之前 | |
LICENSE | 10 年之前 | |
README.md | 7 年之前 | |
barcode.go | 7 年之前 | |
scaledbarcode.go | 7 年之前 |
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.