diff options
author | Kurt <kurt.w.jung@gmail.com> | 2018-11-01 11:51:50 -0400 |
---|---|---|
committer | Kurt <kurt.w.jung@gmail.com> | 2018-11-01 11:51:50 -0400 |
commit | e200d3e7c7ef20b29a47b67e58b7561f4099e7ae (patch) | |
tree | 5d67557275f4ab3c1fb8d495c1d179d62fa0cf87 | |
parent | 1e278c483c1f927b37a1ffd8e4d98b2c0b22a3d3 (diff) |
Explain in documentation why CreateTemplate() is deprecated.
-rw-r--r-- | def.go | 2 | ||||
-rw-r--r-- | template.go | 10 |
2 files changed, 10 insertions, 2 deletions
@@ -268,6 +268,8 @@ type FontLoader interface { Open(name string) (io.Reader, error) } +// Pdf defines the interface used for various methods. It is implemented by the +// main FPDF instance as well as templates. type Pdf interface { AddFont(familyStr, styleStr, fileStr string) AddFontFromBytes(familyStr, styleStr string, jsonFileBytes, zFileBytes []byte) diff --git a/template.go b/template.go index 0c86762..0bb7f75 100644 --- a/template.go +++ b/template.go @@ -31,7 +31,13 @@ func (f *Fpdf) CreateTemplateCustom(corner PointType, size SizeType, fn func(*Tp return newTpl(corner, size, f.defOrientation, f.unitStr, f.fontDirStr, fn, f) } -// CreateTemplate creates a template not attached to any document (deprecated) +// CreateTemplate creates a template that is not attached to any document. +// +// This function is deprecated; it incorrectly assumes that a page with a width +// smaller than its height is oriented in portrait mode, otherwise it assumes +// landscape mode. This causes problems when placing the template in a master +// document where this condition does not apply. CreateTpl() is a similar +// function that lets you specify the orientation to avoid this problem. func CreateTemplate(corner PointType, size SizeType, unitStr, fontDirStr string, fn func(*Tpl)) Template { orientationStr := "p" if size.Wd > size.Ht { @@ -41,7 +47,7 @@ func CreateTemplate(corner PointType, size SizeType, unitStr, fontDirStr string, return CreateTpl(corner, size, orientationStr, unitStr, fontDirStr, fn) } -// CreateTemplate creates a template not attached to any document +// CreateTpl 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) } |