diff options
author | Kurt <kurt.w.jung@gmail.com> | 2016-07-30 11:06:04 -0400 |
---|---|---|
committer | Kurt <kurt.w.jung@gmail.com> | 2016-07-30 11:06:04 -0400 |
commit | 9d37149a8b21e4566cca0c844d25a80769dbd302 (patch) | |
tree | ce1128a9020335884c2700eea5d502e69f47bf77 /fpdf_test.go | |
parent | 11f22e6f7d4f331772e7999a14bb7ade23028f19 (diff) | |
parent | a7290bf6598b103a0fcdb5ce25182e83c00e881b (diff) |
Merge branch 'prsolucoes-master'
Diffstat (limited to 'fpdf_test.go')
-rw-r--r-- | fpdf_test.go | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/fpdf_test.go b/fpdf_test.go index e0018a4..d73818e 100644 --- a/fpdf_test.go +++ b/fpdf_test.go @@ -20,6 +20,9 @@ import ( "bufio" "bytes" "fmt" + "github.com/jung-kurt/gofpdf" + "github.com/jung-kurt/gofpdf/internal/example" + "github.com/jung-kurt/gofpdf/internal/files" "io" "io/ioutil" "math" @@ -28,9 +31,6 @@ import ( "path/filepath" "strconv" "strings" - - "github.com/jung-kurt/gofpdf" - "github.com/jung-kurt/gofpdf/internal/example" ) func init() { @@ -1751,3 +1751,17 @@ func ExampleFpdf_CreateTemplate() { // Output: // Successfully generated pdf/Fpdf_CreateTemplate.pdf } + +// This example demonstrate how to use embedded fonts from byte array +func ExampleEmbeddedBytes() { + pdf := gofpdf.New("P", "mm", "A4", "") + pdf.AddPage() + pdf.AddFontFromBytes("calligra", "", files.CalligraJson, files.CalligraZ) + pdf.SetFont("calligra", "", 16) + pdf.Cell(40, 10, "Hello World With Embedded Font!") + fileStr := example.Filename("Fpdf_EmbeddedFont") + err := pdf.OutputFileAndClose(fileStr) + example.Summary(err, fileStr) + // Output: + // Successfully generated pdf/Fpdf_EmbeddedFont.pdf +} |