...

Package example

import "github.com/jung-kurt/gofpdf/internal/example"
Overview
Index
Examples

Overview ▾

Package example provides some helper routines for the test packages of gofpdf and its various contributed packages located beneath the contrib directory.

func Filename

func Filename(baseStr string) string

Filename returns a qualified filename in which the example PDF directory path is prepended and the suffix ".pdf" is appended to the specified filename.

Example

ExampleFilename tests the Filename() and Summary() functions.

Code:

fileStr := example.Filename("example")
example.Summary(errors.New("printer on fire"), fileStr)

Output:

printer on fire

func FontDir

func FontDir() string

FontDir returns the path to the font directory.

func FontFile

func FontFile(fileStr string) string

FontFile returns a qualified filename in which the path to the font directory is prepended to the specified filename.

func ImageFile

func ImageFile(fileStr string) string

ImageFile returns a qualified filename in which the path to the image directory is prepended to the specified filename.

func PdfDir

func PdfDir() string

PdfDir returns the path to the PDF output directory.

func PdfFile

func PdfFile(fileStr string) string

PdfFile returns a qualified filename in which the path to the PDF output directory is prepended to the specified filename.

func Summary

func Summary(err error, fileStr string)

Summary generates a predictable report for use by test examples. If the specified error is nil, the filename delimiters are normalized and the filename printed to standard output with a success message. If the specified error is not nil, its String() value is printed to standard output.

func SummaryCompare

func SummaryCompare(err error, fileStr string)

SummaryCompare generates a predictable report for use by test examples. If the specified error is nil, the generated file is compared with a reference copy for byte-for-byte equality. If the files match, then the filename delimiters are normalized and the filename printed to standard output with a success message. If the files do not match, this condition is reported on standard output. If the specified error is not nil, its String() value is printed to standard output.

func TextFile

func TextFile(fileStr string) string

TextFile returns a qualified filename in which the path to the text directory is prepended to the specified filename.