make format=txt display the textual QR code contents
This allows for easy comparison with QR codes extracted from PDFs: pdfimages -png invoice.pdf invoice && \ zbarimg --raw invoice*.png > code.txt
This commit is contained in:
@@ -27,7 +27,6 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/mattn/go-isatty"
|
||||
"github.com/stapelberg/qrbill"
|
||||
|
||||
@@ -184,7 +183,7 @@ func logic() error {
|
||||
|
||||
case "txt":
|
||||
w.Header().Add("Content-Type", "text/plain; charset=utf-8")
|
||||
spew.Fdump(w, qrch.Validate())
|
||||
fmt.Fprintf(w, "%s", bill.EncodeToString())
|
||||
|
||||
case "html":
|
||||
debugHTML(w, r, prefix, qrch)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build gokrazy
|
||||
// +build gokrazy
|
||||
|
||||
// Copyright 2020 Google LLC
|
||||
|
||||
@@ -263,6 +263,10 @@ type Bill struct {
|
||||
qrcontents string
|
||||
}
|
||||
|
||||
func (b *Bill) EncodeToString() string {
|
||||
return b.qrcontents
|
||||
}
|
||||
|
||||
func (b *Bill) EncodeToSVG() ([]byte, error) {
|
||||
var err error
|
||||
code, err := encoder.Encoder_encode(b.qrcontents, decoder.ErrorCorrectionLevel_M, qrEncodeHints())
|
||||
|
||||
1
third_party/goembed/goembed.go
vendored
1
third_party/goembed/goembed.go
vendored
@@ -1,5 +1,6 @@
|
||||
// copied from https://github.com/dsymonds/goembed/ with pull requests applied
|
||||
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
// goembed - Embed data in Go source code
|
||||
|
||||
Reference in New Issue
Block a user