diff options
Diffstat (limited to 'fpdf.go')
-rw-r--r-- | fpdf.go | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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) { |