summaryrefslogtreecommitdiff
path: root/contrib/barcode/barcode.go
diff options
context:
space:
mode:
authorJustin Schlechte <justin.schlechte@monsanto.com>2019-05-22 11:24:02 -0500
committerJustin Schlechte <justin.schlechte@monsanto.com>2019-05-22 11:57:13 -0500
commit290b8c334e0f9ce3f5fc95bb70002b13d3300bb5 (patch)
tree67c429291c6c45f8ffb70c531e218c15d149cfa7 /contrib/barcode/barcode.go
parent5f4e2f65402b9aa611f93b2fa14ea69bf7b26d2d (diff)
maintain precision of desired w & h of barcodes
This fixes an issue with barcode scaling that limited barcode sizes to integer multiples of the pdf's unit.
Diffstat (limited to 'contrib/barcode/barcode.go')
-rw-r--r--contrib/barcode/barcode.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/barcode/barcode.go b/contrib/barcode/barcode.go
index ad84fe5..7e0ac0d 100644
--- a/contrib/barcode/barcode.go
+++ b/contrib/barcode/barcode.go
@@ -93,13 +93,17 @@ func printBarcode(pdf barcodePdf, code string, x, y float64, w, h *float64, flow
}
}
+ scaleToWidthF := float64(scaleToWidth)
+ scaleToHeightF := float64(scaleToHeight)
+
if w != nil {
- scaleToWidth = int(*w)
+ scaleToWidthF = *w
}
if h != nil {
- scaleToHeight = int(*h)
+ scaleToHeightF = *h
}
- pdf.Image(bname, x, y, float64(scaleToWidth), float64(scaleToHeight), flow, "jpg", 0, "")
+
+ pdf.Image(bname, x, y, scaleToWidthF, scaleToHeightF, flow, "jpg", 0, "")
}