diff options
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 +} |