Skip to main content

PdfEncryptionOptions.ModificationPermissions Property

Specifies the permissions on document modification operations.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v23.2.Core.dll

NuGet Package: DevExpress.Pdf.Core

Declaration

public PdfDocumentModificationPermissions ModificationPermissions { get; set; }

Property Value

Type Description
PdfDocumentModificationPermissions

A PdfDocumentModificationPermissions enumeration value.

Available values:

Name Description
NotAllowed

Prohibit document modification and assembling.

DocumentAssembling

Allow only document assembling such as inserting, rotating or deleting pages, as well as bookmark creation on the navigation pane.

Allowed

Permit document modification and assembling.

Property Paths

You can access this nested property as listed below:

Object Type Path to ModificationPermissions
PdfSaveOptions
.EncryptionOptions .ModificationPermissions

Remarks

This property can be set to the one of the following values: PdfDocumentModificationPermissions.Allowed, PdfDocumentModificationPermissions.DocumentAssembling and PdfDocumentModificationPermissions.NotAllowed.

To restrict document modification 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 modification permissions using the ModificationPermissions 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.

Example

This example shows how a PDF document can be protected using both the owner and user passwords.

Refer to the following topic fro more information: Document Protection

View Example

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");

        // Specify printing, data extraction, modification, and interactivity permissions. 
        PdfEncryptionOptions encryptionOptions = new PdfEncryptionOptions();
        encryptionOptions.PrintingPermissions = PdfDocumentPrintingPermissions.Allowed;
        encryptionOptions.DataExtractionPermissions = PdfDocumentDataExtractionPermissions.NotAllowed;
        encryptionOptions.ModificationPermissions = PdfDocumentModificationPermissions.DocumentAssembling;
        encryptionOptions.InteractivityPermissions = PdfDocumentInteractivityPermissions.Allowed;

        // Specify the owner and user passwords for the document.  
        encryptionOptions.OwnerPasswordString = "OwnerPassword";
        encryptionOptions.UserPasswordString = "UserPassword";

        // 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 });
        }
    }
  }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ModificationPermissions 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.

See Also