diff options
author | Kurt Jung <kurt.w.jung@code.google.com> | 2014-02-17 15:55:44 -0500 |
---|---|---|
committer | Kurt Jung <kurt.w.jung@code.google.com> | 2014-02-17 15:55:44 -0500 |
commit | 79de4196673a7d880e08c1ba31fa8243004f9dbf (patch) | |
tree | 1a2f334ef9d4125502487a46243ea62a7c85aede /fpdf_test.go | |
parent | 54926dff7aced06e420e30acacf942650e7a6e59 (diff) |
Added convenience function to write PDF to a file (rather than a Writer interface) and then close the PDF instance.
Diffstat (limited to 'fpdf_test.go')
-rw-r--r-- | fpdf_test.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fpdf_test.go b/fpdf_test.go index aaf5807..be55031 100644 --- a/fpdf_test.go +++ b/fpdf_test.go @@ -124,7 +124,13 @@ func ExampleFpdf_tutorial01() { pdf.AddPage() pdf.SetFont("Arial", "B", 16) pdf.Cell(40, 10, "Hello World!") - pdf.OutputAndClose(docWriter(pdf, 1)) + fileStr := filepath.Join(cnGofpdfDir, "pdf/tutorial01.pdf") + err := pdf.OutputFileAndClose(fileStr) + if err == nil { + fmt.Println("Successfully generated pdf/tutorial01.pdf") + } else { + fmt.Println(err) + } // Output: // Successfully generated pdf/tutorial01.pdf } |