summaryrefslogtreecommitdiff
path: root/pdf/create.go
diff options
context:
space:
mode:
authorJoop Kiefte <ikojba@gmail.com>2020-11-20 04:41:21 +0200
committerJoop Kiefte <ikojba@gmail.com>2020-11-20 04:41:21 +0200
commitbc5470e5b30d0082bdd9eb2c954106235be3e842 (patch)
treea5cc174781192c3f8bb2ff8ed24696916739681f /pdf/create.go
parent0c408ddb8577e7fe2f21a98f79be1f5c10d74a61 (diff)
Add pagenumbers to the PDF
Diffstat (limited to 'pdf/create.go')
-rw-r--r--pdf/create.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pdf/create.go b/pdf/create.go
index 633dd98..eee42ee 100644
--- a/pdf/create.go
+++ b/pdf/create.go
@@ -6,6 +6,7 @@ import (
"github.com/lapingvino/lexington/rules"
"github.com/lapingvino/lexington/font"
+ "strconv"
"github.com/phpdave11/gofpdf"
)
@@ -19,12 +20,21 @@ func (t Tree) pr(a string, text string) {
line(t.PDF, t.Rules.Get(a), t.Rules.Get(a).Prefix+text+t.Rules.Get(a).Postfix)
}
+func pagenumber() {
+
+}
+
func (t Tree) Render() {
var block string
for _, row := range t.F {
switch row.Type {
case "newpage":
block = ""
+ t.PDF.SetHeaderFuncMode(func() {
+ t.PDF.SetY(0.5)
+ t.PDF.SetX(-1)
+ t.PDF.Cell(0, 0, strconv.Itoa(t.PDF.PageNo())+".")
+ }, true)
t.PDF.AddPage()
continue
case "titlepage":