-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Width parameter works like bootstrap * Adapt Image to work with the new version
- Loading branch information
1 parent
10c95da
commit b0c8c39
Showing
17 changed files
with
382 additions
and
193 deletions.
There are no files selected for viewing
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
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,147 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/johnfercher/maroto/pkg/consts" | ||
"github.com/johnfercher/maroto/pkg/pdf" | ||
"github.com/johnfercher/maroto/pkg/props" | ||
"os" | ||
"time" | ||
) | ||
|
||
func main() { | ||
begin := time.Now() | ||
m := pdf.NewMaroto(consts.Portrait, consts.Letter) | ||
m.SetBorder(true) | ||
|
||
m.Row(40, func() { | ||
m.Col(2, func() { | ||
_ = m.FileImage("internal/assets/images/biplane.jpg", props.Rect{ | ||
Center: true, | ||
Percent: 80, | ||
}) | ||
}) | ||
m.Col(4, func() { | ||
_ = m.FileImage("internal/assets/images/biplane.jpg", props.Rect{ | ||
Center: true, | ||
Percent: 80, | ||
}) | ||
}) | ||
m.Col(6, func() { | ||
_ = m.FileImage("internal/assets/images/biplane.jpg", props.Rect{ | ||
Center: true, | ||
Percent: 80, | ||
}) | ||
}) | ||
}) | ||
|
||
m.Row(40, func() { | ||
m.Col(2, func() { | ||
_ = m.FileImage("internal/assets/images/biplane.jpg", props.Rect{ | ||
Center: false, | ||
Percent: 50, | ||
Left: 10, | ||
}) | ||
}) | ||
m.Col(4, func() { | ||
_ = m.FileImage("internal/assets/images/biplane.jpg", props.Rect{ | ||
Center: false, | ||
Percent: 50, | ||
Top: 10, | ||
}) | ||
}) | ||
m.Col(6, func() { | ||
_ = m.FileImage("internal/assets/images/biplane.jpg", props.Rect{ | ||
Center: false, | ||
Percent: 50, | ||
Left: 15, | ||
Top: 15, | ||
}) | ||
}) | ||
}) | ||
|
||
m.Row(40, func() { | ||
m.Col(8, func() { | ||
_ = m.FileImage("internal/assets/images/biplane.jpg", props.Rect{ | ||
Center: true, | ||
Percent: 80, | ||
}) | ||
}) | ||
m.Col(4, func() { | ||
_ = m.FileImage("internal/assets/images/biplane.jpg", props.Rect{ | ||
Center: true, | ||
Percent: 80, | ||
}) | ||
}) | ||
}) | ||
|
||
m.Row(40, func() { | ||
m.Col(6, func() { | ||
_ = m.FileImage("internal/assets/images/frontpage.png", props.Rect{ | ||
Center: false, | ||
Percent: 80, | ||
Top: 5, | ||
Left: 10, | ||
}) | ||
}) | ||
m.Col(4, func() { | ||
_ = m.FileImage("internal/assets/images/frontpage.png", props.Rect{ | ||
Center: false, | ||
Percent: 80, | ||
Top: 5, | ||
}) | ||
}) | ||
m.Col(2, func() { | ||
_ = m.FileImage("internal/assets/images/frontpage.png", props.Rect{ | ||
Center: false, | ||
Percent: 80, | ||
Left: 5, | ||
}) | ||
}) | ||
}) | ||
|
||
m.Row(40, func() { | ||
m.Col(6, func() { | ||
_ = m.FileImage("internal/assets/images/frontpage.png", props.Rect{ | ||
Center: true, | ||
Percent: 50, | ||
}) | ||
}) | ||
m.Col(4, func() { | ||
_ = m.FileImage("internal/assets/images/frontpage.png", props.Rect{ | ||
Center: true, | ||
Percent: 50, | ||
}) | ||
}) | ||
m.Col(2, func() { | ||
_ = m.FileImage("internal/assets/images/frontpage.png", props.Rect{ | ||
Center: true, | ||
Percent: 50, | ||
}) | ||
}) | ||
}) | ||
|
||
m.Row(40, func() { | ||
m.Col(4, func() { | ||
_ = m.FileImage("internal/assets/images/frontpage.png", props.Rect{ | ||
Center: true, | ||
Percent: 80, | ||
}) | ||
}) | ||
m.Col(8, func() { | ||
_ = m.FileImage("internal/assets/images/frontpage.png", props.Rect{ | ||
Center: true, | ||
Percent: 80, | ||
}) | ||
}) | ||
}) | ||
|
||
err := m.OutputFileAndClose("internal/examples/pdfs/imagegrid.pdf") | ||
if err != nil { | ||
fmt.Println("Could not save PDF:", err) | ||
os.Exit(1) | ||
} | ||
|
||
end := time.Now() | ||
fmt.Println(end.Sub(begin)) | ||
} |
Binary file not shown.
Binary file not shown.
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
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,36 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/johnfercher/maroto/pkg/consts" | ||
"github.com/johnfercher/maroto/pkg/pdf" | ||
"os" | ||
"time" | ||
) | ||
|
||
func main() { | ||
begin := time.Now() | ||
m := pdf.NewMaroto(consts.Portrait, consts.Letter) | ||
m.SetBorder(true) | ||
|
||
m.Row(40, func() { | ||
m.Col(2, func() { | ||
m.Text("Any Text") | ||
}) | ||
/*m.Col(4, func() { | ||
m.Text("Any Text2") | ||
}) | ||
m.Col(6, func() { | ||
m.Text( "Any Text3") | ||
})*/ | ||
}) | ||
|
||
err := m.OutputFileAndClose("internal/examples/pdfs/textgrid.pdf") | ||
if err != nil { | ||
fmt.Println("Could not save PDF:", err) | ||
os.Exit(1) | ||
} | ||
|
||
end := time.Now() | ||
fmt.Println(end.Sub(begin)) | ||
} |
Oops, something went wrong.