Skip to content

Commit

Permalink
Merge pull request #28 from johnfercher/dev
Browse files Browse the repository at this point in the history
tests/increase-code-coverage
  • Loading branch information
johnfercher authored Jun 12, 2019
2 parents ca8e4f6 + 846c386 commit e27d4cc
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 44 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Maroto [![Travis](https://img.shields.io/badge/coverage-77.2%25-green.svg)][travis]
# Maroto [![Travis](https://img.shields.io/badge/coverage-79.4%25-brightgreen.svg)][travis]
A Maroto way to create PDFs. Maroto is inspired in Bootstrap and uses [Gofpdf](https://github.com/jung-kurt/gofpdf). Fast and simple.

> Maroto definition: Brazilian expression, means an astute/clever/intelligent person.
Expand Down
10 changes: 9 additions & 1 deletion maroto.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ func (m *PdfMaroto) FileImage(filePathName string, rectProp *RectProp) {

qtdCols := float64(len(m.colsClosures))

// TODO: Implements not centered
if rectProp.Center {
m.Image.AddFromFile(filePathName, m.offsetY, m.rowColCount, qtdCols, m.rowHeight, rectProp.Percent)
} else {
Expand All @@ -282,6 +283,7 @@ func (m *PdfMaroto) Base64Image(base64 string, extension Extension, rectProp *Re
qtdCols := float64(len(m.colsClosures))
sumOfyOffsets := m.offsetY + rectProp.Top

// TODO: Implements not centered
if rectProp.Center {
m.Image.AddFromBase64(base64, sumOfyOffsets, m.rowColCount, qtdCols, m.rowHeight, rectProp.Percent, extension)
} else {
Expand Down Expand Up @@ -312,7 +314,12 @@ func (m *PdfMaroto) Barcode(code string, rectProp *RectProp) (err error) {
qtdCols := float64(len(m.colsClosures))
sumOfyOffsets := m.offsetY + rectProp.Top

err = m.Code.AddBar(code, sumOfyOffsets, m.rowColCount, qtdCols, m.rowHeight, rectProp.Percent)
// TODO: Implements not centered
if rectProp.Center {
err = m.Code.AddBar(code, sumOfyOffsets, m.rowColCount, qtdCols, m.rowHeight, rectProp.Percent)
} else {
err = m.Code.AddBar(code, sumOfyOffsets, m.rowColCount, qtdCols, m.rowHeight, rectProp.Percent)
}

return
}
Expand All @@ -327,6 +334,7 @@ func (m *PdfMaroto) QrCode(code string, rectProp *RectProp) {
qtdCols := float64(len(m.colsClosures))
sumOfyOffsets := m.offsetY + rectProp.Top

// TODO: Implements not centered
if rectProp.Center {
m.Code.AddQr(code, sumOfyOffsets, m.rowColCount, qtdCols, m.rowHeight, rectProp.Percent)
} else {
Expand Down
Loading

0 comments on commit e27d4cc

Please sign in to comment.