diff options
author | Kurt <kurt.w.jung@gmail.com> | 2018-07-31 19:44:38 -0400 |
---|---|---|
committer | Kurt <kurt.w.jung@gmail.com> | 2018-07-31 19:44:38 -0400 |
commit | 964b1221fa545d09ad62569f58a94dbbadaad57c (patch) | |
tree | b1baa4149e391535bd0c5466581163d4fefb1380 /contrib | |
parent | c4fb5030287eb4ea19421604fb47933b88e8638f (diff) | |
parent | 57160d276280e078aca3418a30d5256ffa145cc2 (diff) |
Merge branch 'DesignA-Electronics-master'
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/barcode/barcode.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/contrib/barcode/barcode.go b/contrib/barcode/barcode.go index 26f99c3..ad84fe5 100644 --- a/contrib/barcode/barcode.go +++ b/contrib/barcode/barcode.go @@ -71,16 +71,10 @@ func printBarcode(pdf barcodePdf, code string, x, y float64, w, h *float64, flow bname := uniqueBarcodeName(code, x, y) info := pdf.GetImageInfo(bname) + scaleToWidth := unscaled.Bounds().Dx() + scaleToHeight := unscaled.Bounds().Dy() if info == nil { - scaleToWidth := unscaled.Bounds().Dx() - scaleToHeight := unscaled.Bounds().Dy() - if w != nil { - scaleToWidth = int(convertTo96Dpi(pdf, *w)) - } - if h != nil { - scaleToHeight = int(convertTo96Dpi(pdf, *h)) - } bcode, err := barcode.Scale( unscaled, scaleToWidth, @@ -99,7 +93,13 @@ func printBarcode(pdf barcodePdf, code string, x, y float64, w, h *float64, flow } } - pdf.Image(bname, x, y, 0, 0, flow, "jpg", 0, "") + if w != nil { + scaleToWidth = int(*w) + } + if h != nil { + scaleToHeight = int(*h) + } + pdf.Image(bname, x, y, float64(scaleToWidth), float64(scaleToHeight), flow, "jpg", 0, "") } |