summaryrefslogtreecommitdiff
path: root/fpdf_test.go
diff options
context:
space:
mode:
authorDan Meyers <daniel_meyers@brown.edu>2017-06-10 09:32:55 -0400
committerKurt Jung <kurt.w.jung@gmail.com>2017-06-10 09:32:55 -0400
commit78cae719840c4fd9cdd4a1247842c06dde6db36e (patch)
treedc1933566d57622c16194b2813a5144a75c9ddc5 /fpdf_test.go
parent14c1db30737a138f8d9797cffea58783892b2fae (diff)
add the ability to include JavaScript in PDFs (#117)
Diffstat (limited to 'fpdf_test.go')
-rw-r--r--fpdf_test.go14
1 files changed, 14 insertions, 0 deletions
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
+}