Products Product Support Downloads Gallery About us
 


ASP Turbine
 
Features
 
Samples
 
Download
 
Purchase
 
Documentation

 
 
   
Samples Menu

PDF Encryption and
Permissions Sample
(PDF)
 

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:

Compression Level {Media.Compress}
   
Document Subject {Media.PDF.Subject}
Document Author {Media.PDF.Author}
Document Title {Media.PDF.Title}
   
Open Password {Media.PDF.UserPassword}
Encryption Password {Media.PDF.OwnerPassword}
You must provide at least one of the passwords above so the permissions below may work
   
Document Permissions {Media.PDF.Permissions}
 
To select multiple, please hold down the Ctrl key
When the PDF viewer requests an initial password, please supply one of the above Open or Owner Passwords- the default for both is 'letmein'.

   
Samples Menu
   

 
Home  |  Products  |  Support  |  Downloads  |  Gallery  |  Company

Questions or comments? info@blue-pacific.com
© 2005 Blue Pacific Software, all rights reserved.
All trademarks are the property of their respective owners.