-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Standardize nodes * Barcode example done
- Loading branch information
1 parent
120078a
commit 383537a
Showing
7 changed files
with
87 additions
and
11 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
v2 "github.com/johnfercher/maroto/pkg/v2" | ||
"github.com/johnfercher/maroto/pkg/v2/code/barcode" | ||
"github.com/johnfercher/maroto/pkg/v2/grid/col" | ||
"github.com/johnfercher/maroto/pkg/v2/grid/row" | ||
"github.com/johnfercher/maroto/pkg/v2/providers" | ||
"github.com/johnfercher/maroto/pkg/v2/size" | ||
"os" | ||
"time" | ||
|
||
"github.com/johnfercher/maroto/pkg/props" | ||
) | ||
|
||
func main() { | ||
begin := time.Now() | ||
provider := providers.NewGofpdf(size.A4) | ||
maroto := v2.NewMaroto(provider, "internal/examples/pdfs/barcodegridv2.pdf") | ||
m := v2.NewMarotoMetrified(maroto) | ||
|
||
c1 := col.New(2).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Percent: 50, | ||
})) | ||
c2 := col.New(4).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Percent: 75, | ||
})) | ||
c3 := col.New(6).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Percent: 100, | ||
})) | ||
|
||
r1 := row.New(40).Add(c1, c2, c3) | ||
|
||
c4 := col.New(2).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Center: true, | ||
Percent: 50, | ||
})) | ||
c5 := col.New(4).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Center: true, | ||
Percent: 75, | ||
})) | ||
c6 := col.New(6).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Center: true, | ||
Percent: 100, | ||
})) | ||
|
||
r2 := row.New(40).Add(c4, c5, c6) | ||
|
||
c7 := col.New(6).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Percent: 50, | ||
})) | ||
c8 := col.New(4).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Percent: 75, | ||
})) | ||
c9 := col.New(2).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Percent: 100, | ||
})) | ||
|
||
r3 := row.New(40).Add(c7, c8, c9) | ||
|
||
c10 := col.New(6).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Center: true, | ||
Percent: 50, | ||
})) | ||
c11 := col.New(4).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Center: true, | ||
Percent: 75, | ||
})) | ||
c12 := col.New(2).Add(barcode.New("https://github.com/johnfercher/maroto", props.Barcode{ | ||
Center: true, | ||
Percent: 100, | ||
})) | ||
|
||
r4 := row.New(40).Add(c10, c11, c12) | ||
|
||
m.Add(r1, r2, r3, r4) | ||
|
||
err := m.Generate() | ||
if err != nil { | ||
fmt.Println("Could not save PDF:", err) | ||
os.Exit(1) | ||
} | ||
|
||
end := time.Now() | ||
fmt.Println(end.Sub(begin)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.