summaryrefslogtreecommitdiff
path: root/fpdf.go
diff options
context:
space:
mode:
authorYash Kamothi <yash@avendahealth.com>2019-02-27 12:06:52 -0800
committerYash Kamothi <yash@avendahealth.com>2019-02-27 12:06:52 -0800
commit6766a7e6d59e243ee86f02ff6646bdbc6464bbd8 (patch)
treec69d2424368d0d0dbabd837dc09c6a01a76e44ee /fpdf.go
parent567bef933d5649777a8b39772ad57dc9ddaba8d8 (diff)
added functionality to change the current page in the pdf document
Diffstat (limited to 'fpdf.go')
-rw-r--r--fpdf.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/fpdf.go b/fpdf.go
index d6fc123..f18f2ad 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -383,6 +383,12 @@ func (f *Fpdf) SetPageBoxRec(t string, pb PageBox) {
func (f *Fpdf) SetPageBox(t string, x, y, wd, ht float64) {
f.SetPageBoxRec(t, PageBox{SizeType{Wd: wd, Ht: ht}, PointType{X: x, Y: y}})
}
+// SetPage sets the current page to that of a valid page in the PDF document.
+func (f *Fpdf) SetPage(pageNum int) {
+ if (pageNum > 0) && (pageNum < len(f.pages)) {
+ f.page = pageNum
+ }
+}
// SetFontLocation sets the location in the file system of the font and font
// definition files.
@@ -670,6 +676,9 @@ func (f *Fpdf) AddPageFormat(orientationStr string, size SizeType) {
if f.err != nil {
return
}
+ if f.page != len(f.pages)-1 {
+ f.page = len(f.pages)-1
+ }
if f.state == 0 {
f.open()
}
@@ -684,6 +693,7 @@ func (f *Fpdf) AddPageFormat(orientationStr string, size SizeType) {
fc := f.color.fill
tc := f.color.text
cf := f.colorFlag
+
if f.page > 0 {
f.inFooter = true
// Page footer avoid double call on footer.