summaryrefslogtreecommitdiff
path: root/fpdf.go
diff options
context:
space:
mode:
authorLawrence Kesteloot (lk <Lawrence Kesteloot (lk@headcode.com)>2014-07-21 22:44:11 -0700
committerLawrence Kesteloot (lk <Lawrence Kesteloot (lk@headcode.com)>2014-07-21 22:44:11 -0700
commit7b79f51bb56464bcabcd82a31b8ea75c74677689 (patch)
tree738e4c58c901a84a36f0020d2e6068c9c54945c3 /fpdf.go
parent544558bbfab23c6131b62f17cef4dbf494f4c953 (diff)
Add GetMargins() and GetPageSize() methods.
Diffstat (limited to 'fpdf.go')
-rw-r--r--fpdf.go20
1 files changed, 20 insertions, 0 deletions
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.