summaryrefslogtreecommitdiff
path: root/fpdf.go
diff options
context:
space:
mode:
authorMarcus Downing <marcus@bang-on.net>2015-08-04 08:29:46 +0100
committerMarcus Downing <marcus@bang-on.net>2015-08-04 08:29:46 +0100
commit480d3959083ea26fed145ecf7e75361510c4e998 (patch)
tree677c7232f8704cce2fa21ceddf2b0c4efb60aaeb /fpdf.go
parent8f46928acb094c8838f75d663b2f560dbf934773 (diff)
Templating fixes
Diffstat (limited to 'fpdf.go')
-rw-r--r--fpdf.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/fpdf.go b/fpdf.go
index 22de11d..dfd721f 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -72,6 +72,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.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)
@@ -3223,6 +3225,12 @@ func (f *Fpdf) putxobjectdict() {
// foreach($this->images as $image)
f.outf("/I%d %d 0 R", image.i, image.n)
}
+ for _, tpl := range f.templates {
+ id := tpl.ID()
+ if objID, ok := f.templateObjects[id]; ok {
+ f.outf("/TPL%d %d 0 R", id, objID)
+ }
+ }
}
func (f *Fpdf) putresourcedict() {
@@ -3305,6 +3313,7 @@ func (f *Fpdf) putresources() {
return
}
f.putimages()
+ f.putTemplates()
// Resource dictionary
f.offsets[2] = f.buffer.Len()
f.out("2 0 obj")