←Select platform

PDFEncryptionMode Enumeration

Summary
Specifies the PDF encryption mode.
Syntax
C#
C++/CLI
Java
Python
[SerializableAttribute()] 
public enum PDFEncryptionMode  
public final class PDFEncryptionMode 
    extends java.lang.Enum<PDFEncryptionMode> 
[SerializableAttribute()] 
public enum class PDFEncryptionMode  
class PDFEncryptionMode(Enum): 
   RC40Bit = 0 
   RC128Bit = 1 
   None = 2 
Members
ValueMemberDescription
0RC40Bit Use RC 40 bit mode
1RC128Bit Use RC 128 bit mode
2None No encryption
Remarks

The PDFEncryptionMode enumeration is used as the type for the PDFSecurityOptions.EncryptionMode property. It determines the encryption mode to use when creating or updating PDF files.

The password to use with the encryption must be set in the PDFSecurityOptions.UserPassword.

Example
C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.Pdf; 
using Leadtools.Svg; 
 
 
/// This example will encrypt a PDF file with both a user password and an owner password and restrict printing. 
 
public void PDFFileSecurityOptionsExample() 
{ 
   string sourceFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf"); 
   string destinationFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD_EncryptedNoPrint.pdf"); 
 
   PDFFile pdfFile = new PDFFile(sourceFileName); 
 
   // Set the security options 
   pdfFile.SecurityOptions = new PDFSecurityOptions(); 
   pdfFile.SecurityOptions.UserPassword = "LEAD"; 
   pdfFile.SecurityOptions.OwnerPassword = "LEAD_SECRET"; 
   pdfFile.SecurityOptions.PrintEnabled = false; 
   pdfFile.SecurityOptions.HighQualityPrintEnabled = false; 
   pdfFile.SecurityOptions.EncryptionMode = PDFEncryptionMode.RC128Bit; 
 
   // Encrypt the file by saving it to the destination file 
   pdfFile.Convert(1, -1, destinationFileName); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

See Also

Reference

Leadtools.Pdf Namespace

Help Version 22.0.2023.7.10
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Pdf Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.