From 78cae719840c4fd9cdd4a1247842c06dde6db36e Mon Sep 17 00:00:00 2001 From: Dan Meyers Date: Sat, 10 Jun 2017 09:32:55 -0400 Subject: add the ability to include JavaScript in PDFs (#117) --- fpdf_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'fpdf_test.go') diff --git a/fpdf_test.go b/fpdf_test.go index 456295c..5781ad6 100644 --- a/fpdf_test.go +++ b/fpdf_test.go @@ -1857,3 +1857,17 @@ func ExampleFpdf_Rect() { // Output: // Successfully generated pdf/Fpdf_WrappedTableCells.pdf } + +// This example demonstrates including JavaScript in the document. +func ExampleFpdf_SetJavascript() { + pdf := gofpdf.New("P", "mm", "A4", "") + pdf.SetJavascript("print(true);") + pdf.AddPage() + pdf.SetFont("Arial", "", 12) + pdf.Write(10, "Auto-print.") + fileStr := example.Filename("Fpdf_SetJavascript") + err := pdf.OutputFileAndClose(fileStr) + example.Summary(err, fileStr) + // Output: + // Successfully generated pdf/Fpdf_SetJavascript.pdf +} -- cgit v1.2.1-24-ge1ad