diff options
author | Kurt <kurt.w.jung@gmail.com> | 2018-06-15 21:44:55 -0400 |
---|---|---|
committer | Kurt <kurt.w.jung@gmail.com> | 2018-06-15 21:44:55 -0400 |
commit | a4b0fd17b669b43f74a6baa7e93b71d765b82d97 (patch) | |
tree | 3c442faefd7829220c26d17c7019f1fa8259bacd /fpdf_test.go | |
parent | 0298ebb7bb539ad17daadce86bedbdfd56c2bcd4 (diff) |
Support negative X position when placing image
Diffstat (limited to 'fpdf_test.go')
-rw-r--r-- | fpdf_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fpdf_test.go b/fpdf_test.go index 9f0ee96..d9fa429 100644 --- a/fpdf_test.go +++ b/fpdf_test.go @@ -714,6 +714,26 @@ func ExampleFpdf_Image() { // Successfully generated pdf/Fpdf_Image.pdf } +// This example demonstrates how the AllowNegativePosition field of the +// ImageOption struct can be used to affect horizontal image placement. +func ExampleFpdf_ImageOption() { + var opt gofpdf.ImageOptions + + pdf := gofpdf.New("P", "mm", "A4", "") + pdf.AddPage() + pdf.SetFont("Arial", "", 11) + pdf.SetX(60) + opt.ImageType = "png" + pdf.ImageOptions(example.ImageFile("logo.png"), -10, 10, 30, 0, false, opt, 0, "") + opt.AllowNegativePosition = true + pdf.ImageOptions(example.ImageFile("logo.png"), -10, 50, 30, 0, false, opt, 0, "") + fileStr := example.Filename("Fpdf_ImageOption") + err := pdf.OutputFileAndClose(fileStr) + example.Summary(err, fileStr) + // Output: + // Successfully generated pdf/Fpdf_ImageOption.pdf +} + // This examples demonstrates Landscape mode with images. func ExampleFpdf_SetAcceptPageBreakFunc() { var y0 float64 |