summaryrefslogtreecommitdiff
path: root/fpdf_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'fpdf_test.go')
-rw-r--r--fpdf_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/fpdf_test.go b/fpdf_test.go
index 9ef3b3f..fc9d6a5 100644
--- a/fpdf_test.go
+++ b/fpdf_test.go
@@ -1184,3 +1184,15 @@ func ExampleFpdf_tutorial23() {
// Output:
// Successfully generated pdf/tutorial23.pdf
}
+
+// This example demonstrates document protection.
+func ExampleFpdf_tutorial24() {
+ pdf := gofpdf.New("P", "mm", "A4", cnFontDir) // A4 210.0 x 297.0
+ pdf.SetProtection(gofpdf.CnProtectPrint, "123", "abc")
+ pdf.AddPage()
+ pdf.SetFont("Arial", "", 12)
+ pdf.Write(10, "You can print me but not copy my text.")
+ pdf.OutputAndClose(docWriter(pdf, 24))
+ // Output:
+ // Successfully generated pdf/tutorial24.pdf
+}