Click or drag to resize

PdfPermissions Enumeration

Specifies the operations that are allowed to a user on an encrypted PDF document.

Namespace:  Aspose.Words.Saving
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.5.0

ExpandedSyntax

[FlagsAttribute]
public enum PdfPermissions

ExpandedMembers

  Member nameValueDescription
DisallowAll0 Disallows all operations on the PDF document. This is the default value.
AllowAll65535 Allows all operations on the PDF document.
ContentCopy16 Allows copying or otherwise extracting text and graphics from the document, including extraction for accessibility purposes.
ContentCopyForAccessibility512 Allows extract text and graphics in support of accessibility to disabled users or for other purposes. When using RC4 40-bit encryption, this option is ignored and accessibility is allowed whenever ContentCopy is set.
ModifyContents8 Allows modifying the document’s contents.
ModifyAnnotations32 Allows adding or modifying text annotations. When using RC4 40-bit encryption, this option also allows filling in form fields.
FillIn256 Allows filling in forms and signing the document. When using RC4 40-bit encryption, this option is ignored and filling in form is allowed whenever ModifyAnnotations is set.
DocumentAssembly1024 Allows assembling the document: inserting, rotating, or deleting pages and creating navigation elements such as bookmarks or thumbnail images. When using RC4 40-bit encryption, this option is ignored and document assembly is allowed when ModifyContents is set.
Printing4 Allows printing the document.
HighResolutionPrinting2052 Allows printing the document to the highest resolution possible. When using RC4 40-bit encryption, this option is ignored and high resolution printing is allowed when Printing is set.

ExpandedExamples

Shows how to set permissions on a saved PDF document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Writeln("Hello world!");

PdfEncryptionDetails encryptionDetails =
    new PdfEncryptionDetails("password", string.Empty, PdfEncryptionAlgorithm.RC4_128);

// Start by disallowing all permissions.
encryptionDetails.Permissions = PdfPermissions.DisallowAll;

// Extend permissions to allow the editing of annotations.
encryptionDetails.Permissions = PdfPermissions.ModifyAnnotations | PdfPermissions.DocumentAssembly;

// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions saveOptions = new PdfSaveOptions();

// Enable encryption via the "EncryptionDetails" property.
saveOptions.EncryptionDetails = encryptionDetails;

// When we open this document, we will need to provide the password before accessing its contents.
doc.Save(ArtifactsDir + "PdfSaveOptions.EncryptionPermissions.pdf", saveOptions);

ExpandedSee Also