From c27eea9fd19b65f75c4326c12446e829b39ab66d Mon Sep 17 00:00:00 2001 From: Paul Montag Date: Fri, 14 Dec 2018 11:34:00 -0600 Subject: Refactored Encode and Decode functions, Fixed Template ID Conflicts - Updated Encode and Decode to ensure templates and images are pointers to the original objects - Refactored so encoding no longer has to create p and o labels for images - removed id from template and generate it using Bytes instead. --- fpdf.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'fpdf.go') diff --git a/fpdf.go b/fpdf.go index 99c087e..46fe007 100644 --- a/fpdf.go +++ b/fpdf.go @@ -83,8 +83,8 @@ func fpdfNew(orientationStr, unitStr, sizeStr, fontDirStr string, size SizeType) f.fonts = make(map[string]fontDefType) f.fontFiles = make(map[string]fontFileType) f.diffs = make([]string, 0, 8) - f.templates = make(map[int64]Template) - f.templateObjects = make(map[int64]int) + f.templates = make(map[string]Template) + f.templateObjects = make(map[string]int) f.images = make(map[string]*ImageInfoType) f.pageLinks = make([][]linkType, 0, 8) f.pageLinks = append(f.pageLinks, make([]linkType, 0, 0)) // pageLinks[0] is unused (1-based) @@ -3559,8 +3559,8 @@ func (f *Fpdf) putxobjectdict() { } } { - var keyList []int64 - var key int64 + var keyList []string + var key string var tpl Template keyList = templateKeyList(f.templates, f.catalogSort) for _, key = range keyList { @@ -3568,7 +3568,7 @@ func (f *Fpdf) putxobjectdict() { // for _, tpl := range f.templates { id := tpl.ID() if objID, ok := f.templateObjects[id]; ok { - f.outf("/TPL%d %d 0 R", id, objID) + f.outf("/TPL%s %d 0 R", id, objID) } } } -- cgit v1.2.1-24-ge1ad