diff options
author | Kurt <kurt.w.jung@gmail.com> | 2016-08-18 11:53:32 -0400 |
---|---|---|
committer | Kurt <kurt.w.jung@gmail.com> | 2016-08-18 11:53:32 -0400 |
commit | 157aff3575e05946317098493519bb770b328972 (patch) | |
tree | 675c84f2ec31fdab6dc4ced54be388de7a9af29c /template.go | |
parent | 5f4a9bf681f9360dc6485cb34108b7fd0bb43c02 (diff) |
Allow default compression mode to be set. Go 1.7 introduces a new compression/flate routine that results in different compressed streams than before. Consequently, PDFs generated with go 1.7 are not generally binary-equivalent with those generated with previous versions. Turning off compression for test files removes this variability. However, it does not help with PDFs that contain images. For now, those reference PDFs have been removed to allow tests to proceed.
Diffstat (limited to 'template.go')
-rw-r--r-- | template.go | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/template.go b/template.go index 6f29196..1826fd7 100644 --- a/template.go +++ b/template.go @@ -109,6 +109,24 @@ type Template interface { Templates() []Template } +func (f *Fpdf) templateFontCatalog() { + var keyList []string + var font fontDefType + var key string + f.out("/Font <<") + for key = range f.fonts { + keyList = append(keyList, key) + } + if f.catalogSort { + sort.Strings(keyList) + } + for _, key = range keyList { + font = f.fonts[key] + f.outf("/F%d %d 0 R", font.I, font.N) + } + f.out(">>") +} + // putTemplates writes the templates to the PDF func (f *Fpdf) putTemplates() { filter := "" @@ -135,23 +153,7 @@ func (f *Fpdf) putTemplates() { f.out("/Resources ") f.out("<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]") - f.out("/Font <<") - { - var keyList []string - var font fontDefType - var key string - for key = range f.fonts { - keyList = append(keyList, key) - } - if f.catalogSort { - sort.Strings(keyList) - } - for _, key = range keyList { - font = f.fonts[key] - f.outf("/F%d %d 0 R", font.I, font.N) - } - } - f.out(">>") + f.templateFontCatalog() tImages := t.Images() tTemplates := t.Templates() |