summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--template.go18
-rw-r--r--template_impl.go6
2 files changed, 15 insertions, 9 deletions
diff --git a/template.go b/template.go
index 60b076b..0c86762 100644
--- a/template.go
+++ b/template.go
@@ -23,17 +23,27 @@ import (
// CreateTemplate defines a new template using the current page size.
func (f *Fpdf) CreateTemplate(fn func(*Tpl)) Template {
- return newTpl(PointType{0, 0}, f.curPageSize, f.unitStr, f.fontDirStr, fn, f)
+ return newTpl(PointType{0, 0}, f.curPageSize, f.defOrientation, f.unitStr, f.fontDirStr, fn, f)
}
// CreateTemplateCustom starts a template, using the given bounds.
func (f *Fpdf) CreateTemplateCustom(corner PointType, size SizeType, fn func(*Tpl)) Template {
- return newTpl(corner, size, f.unitStr, f.fontDirStr, fn, f)
+ return newTpl(corner, size, f.defOrientation, f.unitStr, f.fontDirStr, fn, f)
}
-// CreateTemplate creates a template not attached to any document
+// CreateTemplate creates a template not attached to any document (deprecated)
func CreateTemplate(corner PointType, size SizeType, unitStr, fontDirStr string, fn func(*Tpl)) Template {
- return newTpl(corner, size, unitStr, fontDirStr, fn, nil)
+ orientationStr := "p"
+ if size.Wd > size.Ht {
+ orientationStr = "l"
+ }
+
+ return CreateTpl(corner, size, orientationStr, unitStr, fontDirStr, fn)
+}
+
+// CreateTemplate creates a template not attached to any document
+func CreateTpl(corner PointType, size SizeType, orientationStr, unitStr, fontDirStr string, fn func(*Tpl)) Template {
+ return newTpl(corner, size, orientationStr, unitStr, fontDirStr, fn, nil)
}
// UseTemplate adds a template to the current page or another template,
diff --git a/template_impl.go b/template_impl.go
index 01bb040..76c5019 100644
--- a/template_impl.go
+++ b/template_impl.go
@@ -18,11 +18,7 @@ package gofpdf
*/
// newTpl creates a template, copying graphics settings from a template if one is given
-func newTpl(corner PointType, size SizeType, unitStr, fontDirStr string, fn func(*Tpl), copyFrom *Fpdf) Template {
- orientationStr := "p"
- if size.Wd > size.Ht {
- orientationStr = "l"
- }
+func newTpl(corner PointType, size SizeType, orientationStr, unitStr, fontDirStr string, fn func(*Tpl), copyFrom *Fpdf) Template {
sizeStr := ""
fpdf := fpdfNew(orientationStr, unitStr, sizeStr, fontDirStr, size)