Skip to content

Commit

Permalink
Merge branch 'DesignA-Electronics-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jung-kurt committed Jul 31, 2018
2 parents c4fb503 + 57160d2 commit 964b122
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions contrib/barcode/barcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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, "")

}

Expand Down

0 comments on commit 964b122

Please sign in to comment.