summaryrefslogtreecommitdiff
path: root/fpdf_test.go
diff options
context:
space:
mode:
authorPaul Montag <pmontag@iseeme.com>2018-11-07 08:51:37 -0600
committerPaul Montag <pmontag@iseeme.com>2018-11-07 08:51:37 -0600
commit01381ea7603b12304064fcd01a49b1cc4434b4ca (patch)
tree386c29e73ec1d2d34633f6d76971e168f9bcbdb5 /fpdf_test.go
parentbc10d22b451bd5ecfdc2d06dc12c1c7d94adb2d2 (diff)
Created helper functions for serialiation
Diffstat (limited to 'fpdf_test.go')
-rw-r--r--fpdf_test.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/fpdf_test.go b/fpdf_test.go
index e212d95..19bc533 100644
--- a/fpdf_test.go
+++ b/fpdf_test.go
@@ -19,7 +19,6 @@ package gofpdf_test
import (
"bufio"
"bytes"
- "encoding/gob"
"fmt"
"io"
"io/ioutil"
@@ -1951,18 +1950,9 @@ func ExampleFpdf_CreateTemplate() {
pdf.SetLineWidth(2.5)
pdf.SetFont("Arial", "B", 16)
- template3 := new(gofpdf.FpdfTpl)
- b := new(bytes.Buffer)
- enc := gob.NewEncoder(b)
-
- if err := enc.Encode(template); err != nil {
- pdf.SetError(err)
- }
-
- dec := gob.NewDecoder(b)
- if err := dec.Decode(template3); err != nil {
- pdf.SetError(err)
- }
+ // serialize and deserialize template
+ b, _ := template2.Serialize()
+ template3, _ := gofpdf.DeserializeTemplate(b)
pdf.AddPage()
pdf.UseTemplate(template3)