[SerializableAttribute()]
public enum PDFEncryptionMode
<SerializableAttribute()>
Public Enum PDFEncryptionMode
public final class PDFEncryptionMode
extends java.lang.Enum<PDFEncryptionMode>
[SerializableAttribute()]
public enum class PDFEncryptionMode
Value | Member | Description |
---|---|---|
0 | RC40Bit | Use RC 40 bit mode |
1 | RC128Bit | Use RC 128 bit mode |
2 | None | No encryption |
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.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls;
using Leadtools.Drawing;
using Leadtools.ImageProcessing;
using Leadtools.Pdf;
using Leadtools.Svg;
using Leadtools.WinForms;
/// 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:\LEADTOOLS21\Resources\Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Pdf
Imports Leadtools.WinForms
Imports Leadtools.Svg
Imports Leadtools.ImageProcessing
''' This example will encrypt a PDF file with both a user password and an owner password and restrict printing.
Public Sub PDFFileSecurityOptionsExample()
Dim sourceFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf")
Dim destinationFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "LEAD_EncryptedNoPrint.pdf")
Dim pdfFile As 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)
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images"
End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document