Turbine
can make a PDF document secure by encrypting it - permissions can
easily be allowed or denied for the generated document, such as the
capability to: print it, change it, copy its contents and comment
it. These settings are controlled through Turbine variables as shown
below. This sample also shows how to control the compression rate
of a document.
The
next ASP.NET C# Script code excerpt shows how this can be accomplished:
<%
//
create the Turbine object:
Turbine.Turbine7 Turbine = new Turbine.Turbine7();
//
set a medium compression rate
Turbine.Variable["Media.Compress"] = 6;
// set the document subject
Turbine.Variable["Media.PDF.Subject"] = "January
Invoice";
// set the document author
Turbine.Variable["Media.PDF.Author"] = "ACME
Company";
// set the document title
Turbine.Variable["Media.PDF.Title"] = "Invoice";
//
the document user must know this password
//to
be able to open it
Turbine.Variable["Media.PDF.UserPassword"] =
"letmein";
// set the owner password
Turbine.Variable["Media.PDF.OwnerPassword"]
= "letmein";
// set permissions so no one can
change the document
Turbine.Variable["Media.PDF.Permissions"] =
"noChanging";
//
continue with document creation...
%> |
|
To
see the properties of a PDF document, you must open "Document
Properties" which in Adobe Acrobat Reader can be accessed with
'Ctrl+D'.
Some
of the available parameters:
When
the PDF viewer requests an initial password, please supply one of
the above Open or Owner Passwords- the default for both is 'letmein'.