officefileapi-devexpress-dot-pdf-dot-pdfencryptionoptions-d97df20c.md
Specifies the permissions on data extraction operations.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfDocumentDataExtractionPermissions DataExtractionPermissions { get; set; }
Public Property DataExtractionPermissions As PdfDocumentDataExtractionPermissions
| Type | Description |
|---|---|
| PdfDocumentDataExtractionPermissions |
A PdfDocumentDataExtractionPermissions enumeration value.
|
Available values:
| Name | Description |
|---|---|
| NotAllowed |
Prohibit data extraction operations (copying or text and graphics extraction from the document) including access for the software that uses assistive technologies.
| | Accessibility |
Allow PDF Viewers to access document contents by using the Viewer’s accessibility features.
| | Allowed |
Permit data extraction operations (copying or text and graphics extraction from the document) including access for the software that uses assistive technologies.
|
You can access this nested property as listed below:
| Object Type | Path to DataExtractionPermissions |
|---|---|
| PdfSaveOptions |
.EncryptionOptions .DataExtractionPermissions
|
This property can be set to the one of the following values: PdfDocumentDataExtractionPermissions.Allowed, PdfDocumentDataExtractionPermissions.Accessibility and PdfDocumentDataExtractionPermissions.NotAllowed.
To restrict data extraction operations with a PDF document, create a PdfEncryptionOptions object using the PdfSaveOptions.EncryptionOptions property and specify the owner password using the PdfEncryptionOptions.OwnerPasswordString property, and data extraction permissions using the DataExtractionPermissions property.
The owner password allows a user to have full access to a document.
Note
The restrictions on data extraction, data modification, interactive, or printing operations with a PDF document can’t be applied without the owner password.
For more information, see the Document Protection topic.
This example shows how a PDF document can be protected using both the owner and user passwords.
Refer to the following topic for more information: Document Protection
using DevExpress.Pdf;
namespace PDFPasswordProtection {
class Program {
static void Main(string[] args) {
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor()) {
// Load a PDF document.
pdfDocumentProcessor.LoadDocument(@"..\..\Demo.pdf");
// Initialize encryption options with owner and user passwords.
PdfEncryptionOptions encryptionOptions = new PdfEncryptionOptions(
ownerPassword: "OwnerPassword",
userPassword: "UserPassword"
);
// Specify printing, data extraction, modification, and interactivity permissions.
encryptionOptions.PrintingPermissions = PdfDocumentPrintingPermissions.Allowed;
encryptionOptions.DataExtractionPermissions = PdfDocumentDataExtractionPermissions.NotAllowed;
encryptionOptions.ModificationPermissions = PdfDocumentModificationPermissions.DocumentAssembling;
encryptionOptions.InteractivityPermissions = PdfDocumentInteractivityPermissions.Allowed;
// Specify the 256-bit AES encryption algorithm.
encryptionOptions.Algorithm = PdfEncryptionAlgorithm.AES256;
// Save the protected document with encryption settings.
pdfDocumentProcessor.SaveDocument(
@"..\..\ProtectedDocument.pdf",
new PdfSaveOptions() { EncryptionOptions = encryptionOptions }
);
}
}
}
}
Imports DevExpress.Pdf
Module PDFPasswordProtection
Sub Main()
Using pdfDocumentProcessor As New PdfDocumentProcessor()
' Load a PDF document.
pdfDocumentProcessor.LoadDocument("..\..\Demo.pdf")
' Initialize encryption options with owner and user passwords.
Dim encryptionOptions As New PdfEncryptionOptions(
ownerPassword:="OwnerPassword",
userPassword:="UserPassword"
)
' Specify printing, data extraction, modification, and interactivity permissions.
encryptionOptions.PrintingPermissions = PdfDocumentPrintingPermissions.Allowed
encryptionOptions.DataExtractionPermissions = PdfDocumentDataExtractionPermissions.NotAllowed
encryptionOptions.ModificationPermissions = PdfDocumentModificationPermissions.DocumentAssembling
encryptionOptions.InteractivityPermissions = PdfDocumentInteractivityPermissions.Allowed
' Specify the 256-bit AES encryption algorithm.
encryptionOptions.Algorithm = PdfEncryptionAlgorithm.AES256
' Save the protected document with encryption settings.
pdfDocumentProcessor.SaveDocument(
"..\..\ProtectedDocument.pdf",
New PdfSaveOptions() With {.EncryptionOptions = encryptionOptions}
)
End Using
End Sub
End Module
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DataExtractionPermissions property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
pdf-document-api-protect-document-with-password/CS/PDFPasswordProtection/Program.cs#L16
encryptionOptions.PrintingPermissions = PdfDocumentPrintingPermissions.Allowed;
encryptionOptions.DataExtractionPermissions = PdfDocumentDataExtractionPermissions.NotAllowed;
encryptionOptions.ModificationPermissions = PdfDocumentModificationPermissions.DocumentAssembling;
pdf-document-api-protect-document-with-password/VB/PDFPasswordProtection/Program.vb#L15
encryptionOptions.PrintingPermissions = DevExpress.Pdf.PdfDocumentPrintingPermissions.Allowed
encryptionOptions.DataExtractionPermissions = DevExpress.Pdf.PdfDocumentDataExtractionPermissions.NotAllowed
encryptionOptions.ModificationPermissions = DevExpress.Pdf.PdfDocumentModificationPermissions.DocumentAssembling
See Also