Skip to content

Commit

Permalink
example datamatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
kmpm authored Jun 23, 2021
1 parent b6e05b7 commit 9bf83dc
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/pdf/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,32 @@ func ExamplePdfMaroto_QrCode() {
})
}

// ExamplePdfMaroto_DataMatrixCode demonstrates how to add
// a DataMatrixCode inside a Col.
func ExamplePdfMaroto_DataMatrixCode() {
// Passing nil on rectProps makes
// the DataMatrixCode fill the context cell.
// When center is true, left and top has no effect.
// Percent represents the width/height of the DataMatrixCode inside the cell.
// i.e. 80 means that the DataMatrixCode will take up 80% of Col's width
// When center is false, positioning of the DataMatrixCode can be done through
// left and top.

m := pdf.NewMaroto(consts.Portrait, consts.A4)
rowHeight := 5.0

m.Row(rowHeight, func() {
m.Col(12, func() {
m.DataMatrixCode("https://godoc.org/github.com/johnfercher/maroto", props.Rect{
Left: 5,
Top: 5,
Center: false,
Percent: 80,
})
})
})
}

// ExamplePdfMaroto_Signature demonstrates how to add
// a Signature space inside a col.
func ExamplePdfMaroto_Signature() {
Expand Down

0 comments on commit 9bf83dc

Please sign in to comment.