Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maroto v2 (work in progress) #259

Merged
merged 40 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8081d66
keep
johnfercher Sep 11, 2023
0dd544c
add typing on document type, add text interface
F-Amaral Sep 12, 2023
5cc7521
keep
johnfercher Sep 12, 2023
8c0b7a1
keep
johnfercher Sep 12, 2023
782115a
fix broken accepted search on types
F-Amaral Sep 12, 2023
89c41a4
start grid height and width calculation
F-Amaral Sep 12, 2023
8bdbdde
remove pointer context, add line offset on row
F-Amaral Sep 12, 2023
d944e0d
start adding col children
F-Amaral Sep 12, 2023
2b550c4
Move context
johnfercher Sep 12, 2023
537c622
add context tests, fix side effect copy
F-Amaral Sep 12, 2023
705cfa3
fix col percentage calculation
F-Amaral Sep 12, 2023
4efa2d0
remove uncessesary context return from render
F-Amaral Sep 12, 2023
ff53b30
add col tests
F-Amaral Sep 12, 2023
8d6c36c
fix col test cases values
F-Amaral Sep 12, 2023
2dc182f
add text and image features using new interfaces
F-Amaral Sep 13, 2023
f1b8a6f
add text and image features using new interfaces
F-Amaral Sep 13, 2023
359182a
add base64image and signature types
F-Amaral Sep 13, 2023
c801f4e
Add codes
johnfercher Sep 13, 2023
1da8227
refactor receiver names
F-Amaral Sep 13, 2023
9f08e7a
add page component
F-Amaral Sep 13, 2023
c5a6e9a
Add get structure
johnfercher Sep 13, 2023
0d2fe48
Limit pdf structure errors at compilation time
johnfercher Sep 13, 2023
5f00f8c
keep
johnfercher Sep 13, 2023
a3edf57
keep
johnfercher Sep 13, 2023
bc70855
keep
johnfercher Sep 14, 2023
be3bd66
keep
johnfercher Sep 14, 2023
d388b95
Use cell instead of context
johnfercher Sep 14, 2023
b22dfc7
Add html generator
johnfercher Sep 14, 2023
27a1f02
Add html generator
johnfercher Sep 14, 2023
af833d4
Add html generator
johnfercher Sep 14, 2023
8cc7239
Two generations
johnfercher Sep 14, 2023
00a1ecf
Add html generator
johnfercher Sep 14, 2023
43f7fb8
Provider abstraction v1
johnfercher Sep 14, 2023
ac24677
Fix page computation
johnfercher Sep 14, 2023
9584e3c
Add metrics
johnfercher Sep 14, 2023
d2a2bef
keep
johnfercher Sep 14, 2023
f25fc82
add parallel pdf generation
F-Amaral Sep 14, 2023
e02cbff
fix image
johnfercher Sep 14, 2023
5a900f8
Fix scale
johnfercher Sep 14, 2023
b92d1f4
Fix metrics
johnfercher Sep 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package main

import (
"encoding/base64"
"fmt"
"github.com/johnfercher/maroto/pkg/consts"
"github.com/johnfercher/maroto/pkg/props"
"github.com/johnfercher/maroto/pkg/v2"
"github.com/johnfercher/maroto/pkg/v2/code/barcode"
"github.com/johnfercher/maroto/pkg/v2/code/matrixcode"
"github.com/johnfercher/maroto/pkg/v2/code/qrcode"
"github.com/johnfercher/maroto/pkg/v2/col"
"github.com/johnfercher/maroto/pkg/v2/domain"
"github.com/johnfercher/maroto/pkg/v2/image"
"github.com/johnfercher/maroto/pkg/v2/providers"
"github.com/johnfercher/maroto/pkg/v2/row"
"github.com/johnfercher/maroto/pkg/v2/signature"
"github.com/johnfercher/maroto/pkg/v2/size"
"github.com/johnfercher/maroto/pkg/v2/text"
"log"
"os"
)

func main() {
pageSize := size.A4
pdf := buildMarotoPDF(pageSize)
html := buildMarotoHTML(pageSize)

gen(pdf)
gen(html)
}

func buildMarotoPDF(pageSize size.PageSize) domain.MarotoMetrified {
provider := providers.NewGofpdf(pageSize)
m := v2.NewMaroto(provider, "v2.pdf")
return v2.NewMarotoMetrified(m)
}

func buildMarotoHTML(pageSize size.PageSize) domain.MarotoMetrified {
provider := providers.NewHTML(pageSize)
m := v2.NewMaroto(provider, "v2.html")
return v2.NewMarotoMetrified(m)
}

func gen(m domain.MarotoMetrified) {
m.Add(buildCodesRow(), buildImagesRow(), buildTextsRow())
m.Add(buildCodesRow(), buildImagesRow(), buildTextsRow())
m.Add(buildCodesRow(), buildImagesRow(), buildTextsRow())

report, err := m.GenerateWithReport()
if err != nil {
log.Fatal(err.Error())
}

report.Print()
}

func buildCodesRow() domain.Row {
r := row.New(70)

col1 := col.New(4)
col1.Add(barcode.New("barcode"))

col2 := col.New(4)
col2.Add(qrcode.New("qrcode"))

col3 := col.New(4)
col3.Add(matrixcode.New("matrixcode"))

r.Add(col1, col2, col3)
return r
}

func buildImagesRow() domain.Row {
row := row.New(70)

col1 := col.New(6)
col1.Add(image.NewFromFile("internal/assets/images/biplane.jpg"))

byteSlices, err := os.ReadFile("internal/assets/images/gopherbw.png")
if err != nil {
fmt.Println("Got error while opening file:", err)
os.Exit(1)
}
stringBase64 := base64.StdEncoding.EncodeToString(byteSlices)
col2 := col.New(6)
col2.Add(image.NewFromBase64(stringBase64, consts.Png))

row.Add(col1, col2)

return row
}

func buildTextsRow() domain.Row {
row := row.New(70)

colText := "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac condimentum sem."
col1 := col.New(6)
col1.Add(text.New(colText, props.Text{
Align: consts.Center,
}))

col2 := col.New(6)
col2.Add(signature.New("Fulano de Tal", props.Font{
Style: consts.Italic,
Size: 20,
Family: consts.Courier,
}))

row.Add(col1, col2)

return row
}
24 changes: 21 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
module github.com/johnfercher/maroto

go 1.13
go 1.21.1

require (
github.com/boombuler/barcode v1.0.1
github.com/f-amaral/go-async v0.1.1
github.com/google/uuid v1.3.0
github.com/johnfercher/go-tree v1.0.3
github.com/jung-kurt/gofpdf v1.16.2
github.com/pdfcpu/pdfcpu v0.5.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hhrutter/lzw v1.0.0 // indirect
github.com/hhrutter/tiff v1.0.1 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.3.0
github.com/stretchr/objx v0.5.0 // indirect
golang.org/x/image v0.11.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/text v0.13.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
71 changes: 67 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@ github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/f-amaral/go-async v0.1.1 h1:h1yVJmDdAs5k6cgSf+YFObFc5uzObeUPcwNJKpDoCOU=
github.com/f-amaral/go-async v0.1.1/go.mod h1:Hz5Qr6DAWpbTTUjytnrg1WIsDgS7NtOei5y8SipYS7U=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hhrutter/lzw v1.0.0 h1:laL89Llp86W3rRs83LvKbwYRx6INE8gDn0XNb1oXtm0=
github.com/hhrutter/lzw v1.0.0/go.mod h1:2HC6DJSn/n6iAZfgM3Pg+cP1KxeWc3ezG8bBqW5+WEo=
github.com/hhrutter/tiff v1.0.1 h1:MIus8caHU5U6823gx7C6jrfoEvfSTGtEFRiM8/LOzC0=
github.com/hhrutter/tiff v1.0.1/go.mod h1:zU/dNgDm0cMIa8y8YwcYBeuEEveI4B0owqHyiPpJPHc=
github.com/johnfercher/go-tree v1.0.3 h1:BXRRefRH4cuMU6qPIL7sVAMlw/g4QNa2sbW61G41Fg0=
github.com/johnfercher/go-tree v1.0.3/go.mod h1:DUO6QkXIFh1K7jeGBIkLCZaeUgnkdQAsB64FDSoHswg=
github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/jung-kurt/gofpdf v1.16.2 h1:jgbatWHfRlPYiK85qgevsZTHviWXKwB1TTiKdz5PtRc=
github.com/jung-kurt/gofpdf v1.16.2/go.mod h1:1hl7y57EsiPAkLbOwzpzqgx1A30nQCk/YmFV8S2vmK0=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/pdfcpu/pdfcpu v0.5.0 h1:F3wC4bwPbaJM+RPgm1D0Q4SAUwxElw7BhwNvL3iPgDo=
github.com/pdfcpu/pdfcpu v0.5.0/go.mod h1:UPcHdWcMw1V6Bo5tcWHd3jZfkG8cwUwrJkQOlB6o+7g=
github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY=
github.com/phpdave11/gofpdi v1.0.7/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI=
github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI=
Expand All @@ -17,14 +29,65 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245 h1:K1Xf3bKttbF+koVGaX5xngRIZ5bVjbmPnaxE/dR08uY=
github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4 h1:0sw0nJM544SpsihWx1bkXdYLQDlzRflMgFJQ4Yih9ts=
github.com/yosssi/gohtml v0.0.0-20201013000340-ee4748c638f4/go.mod h1:+ccdNT0xMY1dtc5XBxumbYfOUhmduiGudqaDgD2rVRE=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.11.0 h1:ds2RoQvBvYTiJkwpSFDwCcDFNX7DqjL2WsUgTNk0Ooo=
golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
9 changes: 9 additions & 0 deletions internal/cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ type Cell struct {
Width float64
Height float64
}

func (c Cell) Copy() Cell {
return Cell{
X: c.X,
Y: c.Y,
Width: c.Width,
Height: c.Height,
}
}
14 changes: 11 additions & 3 deletions internal/examples/certificate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,21 @@ func main() {

m.Row(25, func() {
m.Col(4, func() {
m.Signature("Gopher Senior")
m.Signature("Gopher Senior", props.Font{
Size: 10,
})
})
m.Col(4, func() {
m.Signature("Gopheroid")
m.Signature("Gopheroid", props.Font{
Size: 10,
Style: consts.Italic,
})
})
m.Col(4, func() {
m.Signature("Sign Here")
m.Signature("Sign Here", props.Font{
Size: 10,
Family: consts.Courier,
})
})
})

Expand Down
Loading