summaryrefslogtreecommitdiff
path: root/fpdf.go
diff options
context:
space:
mode:
Diffstat (limited to 'fpdf.go')
-rw-r--r--fpdf.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/fpdf.go b/fpdf.go
index 2c6d7c1..adc510b 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -385,13 +385,20 @@ func (f *Fpdf) SetPageBox(t string, x, y, wd, ht float64) {
}
// SetPage sets the current page to that of a valid page in the PDF document.
-// The SetPage() example demonstrates this method.
+// pageNum is one-based. The SetPage() example demonstrates this method.
func (f *Fpdf) SetPage(pageNum int) {
if (pageNum > 0) && (pageNum < len(f.pages)) {
f.page = pageNum
}
}
+// PageCount returns the number of pages currently in the document. Since page
+// numbers in gofpdf are one-based, the page count is the same as the page
+// number of the current last page.
+func (f *Fpdf) PageCount() int {
+ return len(f.pages) - 1
+}
+
// SetFontLocation sets the location in the file system of the font and font
// definition files.
func (f *Fpdf) SetFontLocation(fontDirStr string) {