Click or drag to resize
Pdf Library for .NET

PdfSecurityManager Class

This class provides the options to control the pdf document security. It can also be used to add digital signatures to the pdf document.
Inheritance Hierarchy
SystemObject
  SelectPdfPdfManager
    SelectPdfPdfSecurityManager

Namespace:  SelectPdf
Assembly:  Select.Pdf (in Select.Pdf.dll) Version: 24.1
Syntax
public class PdfSecurityManager : PdfManager

The PdfSecurityManager type exposes the following members.

Constructors
  NameDescription
Public methodPdfSecurityManager
Instantiates the PdfSecurityManager object.
Top
Properties
  NameDescription
Public propertyCanAccessibilityCopyContent
Allows content accessibility copying.
Public propertyCanAssembleDocument
Allows inserting, rotating or deleting pages or bookmarks.
Public propertyCanCopyContent
Allows content copying.
Public propertyCanEditAnnotations
Allows annotations editing.
Public propertyCanEditContent
Allows content editing.
Public propertyCanFillFields
Allows form filling.
Public propertyCanFullQualityPrint
Allows full quality printing.
Public propertyCanPrint
Allows printing.
Public propertyEncryptionAlgorithm
Gets or sets the encryption algorithm.
Public propertyEncryptionKeySize
Gets or sets the length of the encryption key.
Public propertyOwnerPassword
Gets or sets the owner password.
Public propertyUserPassword
Gets or sets the user password.
Top
Methods
  NameDescription
Public methodClose
Closes the opened pdf document.
(Inherited from PdfManager.)
Public methodGetDocument
Returns the pdf document as PdfDocument object.
(Inherited from PdfManager.)
Public methodLoad(Byte)
Loads a pdf document from a byte array.
(Inherited from PdfManager.)
Public methodLoad(Stream)
Loads a pdf document from the specified stream.
(Inherited from PdfManager.)
Public methodLoad(String)
Loads a pdf document from an existing pdf file.
(Inherited from PdfManager.)
Public methodLoad(PdfDocument)
Loads a pdf document from an existing PdfDocument object.
(Inherited from PdfManager.)
Public methodLoad(Byte, String)
Loads a password protected pdf document from a byte array.
(Inherited from PdfManager.)
Public methodLoad(Stream, String)
Loads a pdf document from a stream containing a password protected pdf document.
(Inherited from PdfManager.)
Public methodLoad(String, String)
Loads a pdf document from an existing password protected pdf file.
(Inherited from PdfManager.)
Public methodLoad(PdfDocument, String)
Loads a pdf document from an existing password protected PdfDocument object.
(Inherited from PdfManager.)
Public methodSave
Saves the pdf document as byte array.
(Inherited from PdfManager.)
Public methodSave(Stream)
Saves the pdf document to the specified stream.
(Inherited from PdfManager.)
Public methodSave(String)
Saves the pdf document to the specified file.
(Inherited from PdfManager.)
Public methodSign(String, String)
Sign the pdf document with the specified certificate.
Public methodSign(String, String, String)
Sign the pdf document with the specified certificate.
Public methodSign(String, String, String, String, String, String)
Sign the pdf document with the specified certificate.
Public methodSign(String, String, String, String, String, String, Int32, RectangleF)
Sign the pdf document with the specified certificate.
Public methodSign(String, String, String, String, String, String, Int32, RectangleF, TimeStampAuthority)
Sign the pdf document with the specified certificate.
Top
Examples
The following sample code shows how the security manager can be instantiated and security settings customized:
// load the pdf document using the advanced security manager
PdfSecurityManager security = new PdfSecurityManager();
security.Load(file);

// encryption algorithm and key length
security.EncryptionAlgorithm = PdfEncryptionAlgorithm.AES;
security.EncryptionKeySize = PdfEncryptionKeySize.EncryptKey256Bit;

// set document passwords
security.OwnerPassword = "test1";
security.UserPassword = "test2";

//set document permissions
security.CanAssembleDocument = false;
security.CanCopyContent = true;
security.CanEditAnnotations = true;
security.CanEditContent = true;
security.CanFillFields = true;
security.CanPrint = true;

// add the digital signature
security.Sign(certFile, "selectpdf");

// save pdf document
security.Save(Response, false, "Sample.pdf");

// close pdf document
security.Close();
See Also