From 7b79f51bb56464bcabcd82a31b8ea75c74677689 Mon Sep 17 00:00:00 2001 From: "Lawrence Kesteloot (lk" Date: Mon, 21 Jul 2014 22:44:11 -0700 Subject: Add GetMargins() and GetPageSize() methods. --- fpdf.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'fpdf.go') diff --git a/fpdf.go b/fpdf.go index 4a43fe4..6ad5bd6 100644 --- a/fpdf.go +++ b/fpdf.go @@ -245,6 +245,26 @@ func (f *Fpdf) Error() error { return f.err } +// Return the current page's width and height. This is the paper's size. To +// compute the size of the area being used, subtract the margins (see +// GetMargins()). +func (f *Fpdf) GetPageSize() (width, height float64) { + width = f.w + height = f.h + return +} + +// Return the left, top, right, and bottom margins. The first three are set +// with the SetMargins() method. The bottom margin is set with the +// SetAutoPageBreak() method. +func (f *Fpdf) GetMargins() (left, top, right, bottom float64) { + left = f.lMargin + top = f.tMargin + right = f.rMargin + bottom = f.bMargin + return +} + // SetMargins defines the left, top and right margins. By default, they equal 1 // cm. Call this method to change them. If the value of the right margin is // less than zero, it is set to the same as the left margin. -- cgit v1.2.1-24-ge1ad