Documentation ¶
Overview ¶
Package example provides some helper routines for the test packages of gofpdf and its various contributed packages located beneath the contrib directory.
Index ¶
- func Filename(baseStr string) string
- func FontDir() string
- func FontFile(fileStr string) string
- func ImageFile(fileStr string) string
- func PdfDir() string
- func PdfFile(fileStr string) string
- func Summary(err error, fileStr string)
- func SummaryCompare(err error, fileStr string)
- func TextFile(fileStr string) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filename ¶
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.
package main import ( "errors" "github.com/ofio/gopdf/internal/example" ) func main() { fileStr := example.Filename("example") example.Summary(errors.New("printer on fire"), fileStr) }
Output: printer on fire
func FontFile ¶
FontFile returns a qualified filename in which the path to the font directory is prepended to the specified filename.
func ImageFile ¶
ImageFile returns a qualified filename in which the path to the image directory is prepended to the specified filename.
func PdfFile ¶
PdfFile returns a qualified filename in which the path to the PDF output directory is prepended to the specified filename.
func Summary ¶
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 ¶
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.
Types ¶
This section is empty.