forked from johnfercher/maroto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
101 lines (88 loc) · 1.84 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package main
import (
"fmt"
"os"
"time"
"github.com/johnfercher/maroto/pkg/consts"
"github.com/johnfercher/maroto/pkg/pdf"
"github.com/johnfercher/maroto/pkg/props"
)
func main() {
begin := time.Now()
m := pdf.NewMaroto(consts.Portrait, consts.Letter)
// m.SetBorder(true)
m.Row(40, func() {
m.Col(4, func() {
_ = m.FileImage("internal/assets/images/biplane.jpg", props.Rect{
Center: true,
Percent: 80,
})
})
m.Col(4, func() {
m.Text("Gopher International Shipping, Inc.", props.Text{
Top: 12,
Size: 20,
Extrapolate: true,
})
m.Text("1000 Shipping Gopher Golang TN 3691234 GopherLand (GL)", props.Text{
Size: 12,
Top: 22,
})
})
m.ColSpace(4)
})
m.Line(10)
m.Row(40, func() {
m.Col(4, func() {
m.Text("João Sant'Ana 100 Main Street Stringfield TN 39021 United Stats (USA)", props.Text{
Size: 15,
Top: 12,
})
})
m.ColSpace(4)
m.Col(4, func() {
m.QrCode("https://github.com/johnfercher/maroto", props.Rect{
Center: true,
Percent: 75,
})
})
})
m.Line(10)
m.Row(100, func() {
m.Col(12, func() {
_ = m.Barcode("https://github.com/johnfercher/maroto", props.Barcode{
Center: true,
Percent: 70,
})
m.Text("https://github.com/johnfercher/maroto", props.Text{
Size: 20,
Align: consts.Center,
Top: 65,
})
})
})
m.SetBorder(true)
m.Row(40, func() {
m.Col(6, func() {
m.Text("CODE: 123412351645231245564 DATE: 20-07-1994 20:20:33", props.Text{
Size: 15,
Top: 14,
})
})
m.Col(6, func() {
m.Text("CA", props.Text{
Top: 1,
Size: 85,
Align: consts.Center,
})
})
})
m.SetBorder(false)
err := m.OutputFileAndClose("internal/examples/pdfs/zpl.pdf")
if err != nil {
fmt.Println("Could not save PDF:", err)
os.Exit(1)
}
end := time.Now()
fmt.Println(end.Sub(begin))
}