Document.Security Property
Gets or sets an object to control the security and encryption of the Document .
public Security Security { get; set; }
Public Property Security As Security
Property Value
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example will set the RC4 128 bit security of the document so that anyone who logs in with the user password will not be able to print at high resolution, edit or add annotations or form fields, or access this document from other accessibility programs.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
'Create a PDF Document
Dim document As Document = New Document
'Add a page and add it to the document
Dim page As Page = New Page
document.Pages.Add(page)
'Create a RC4 128 bit security object
Dim security As RC4128Security = New RC4128Security("owner", "user")
' Set the permissions on that security object
security.AllowAccessibility = False
security.AllowDocumentAssembly = False
security.AllowUpdateAnnotsAndFields = False
' Add the security object to the document
document.Security = security
'Create and display a label as a reference
Dim text As String = "This document has been encrypted with RC4 128 bit encryption."
page.Elements.Add(New Label(text, 50, 50, 400, 100, Font.Helvetica, 18))
' Save the PDF
document.Draw(outputPath)
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.Cryptography;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add( page );
// Create a RC4 128 bit security object
RC4128Security security = new RC4128Security( "owner", "user" );
// Set the permissions on that security object
security.AllowAccessibility = false;
security.AllowDocumentAssembly = false;
security.AllowUpdateAnnotsAndFields = false;
// Add the security object to the document
document.Security = security;
// Create and display a label as a reference
string text = "This document has been encrypted with RC4 128 bit encryption.";
page.Elements.Add( new Label( text, 50, 50, 400, 100, Font.Helvetica, 18 ) );
// Save the PDF
document.Draw( outputPath );
}
}
Remarks
This object controls the encryption and security of the generated PDF document.