Class PdfSecurityOptions

Class PdfSecurityOptions

Namespace: Aspose.Cells.Rendering.PdfSecurity
Assembly: Aspose.Cells.dll (25.2.0)

Options for encrypting and access permissions for a PDF document. PDF/A does not allow security setting.

public class PdfSecurityOptions

Inheritance

objectPdfSecurityOptions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

PdfSecurityOptions()

The constructor of PdfSecurityOptions

public PdfSecurityOptions()

Examples

The following code sets high resolution print permisson for the output pdf.

csharp
Workbook wb = new Workbook();
wb.Worksheets[0].Cells["A1"].Value = "Aspose";

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();


PdfSecurityOptions pdfSecurityOptions = new PdfSecurityOptions();

//set owner password
pdfSecurityOptions.OwnerPassword = "YourOwnerPassword";

//set user password
pdfSecurityOptions.UserPassword = "YourUserPassword";

//set print permisson
pdfSecurityOptions.PrintPermission = true;

//set high resolution for print
pdfSecurityOptions.FullQualityPrintPermission = true;


pdfSaveOptions.SecurityOptions = pdfSecurityOptions;

wb.Save("output.pdf", pdfSaveOptions);

Properties

AccessibilityExtractContent

Indicates whether to allow to extract text and graphics (in support of accessibility to users with disabilities or for other purposes).

public bool AccessibilityExtractContent { get; set; }

Property Value

bool

AnnotationsPermission

Indicates whether to allow to add or modify text annotations, fill in interactive form fields.

public bool AnnotationsPermission { get; set; }

Property Value

bool

Remarks

if Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions.ModifyDocumentPermission is also set, create or modify interactive form fields (including signature fields).

AssembleDocumentPermission

Indicates whether to allow to assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions.ModifyDocumentPermission is clear.

public bool AssembleDocumentPermission { get; set; }

Property Value

bool

ExtractContentPermission

Indicates whether to allow to copy or otherwise extract text and graphics from the document by operations other than that controlled by Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions.AccessibilityExtractContent.

public bool ExtractContentPermission { get; set; }

Property Value

bool

FillFormsPermission

Indicates whether to allow to fill in existing interactive form fields (including signature fields), even if Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions.ModifyDocumentPermission is clear.

public bool FillFormsPermission { get; set; }

Property Value

bool

FullQualityPrintPermission

Indicates whether to allow to print the document to a representation from which a faithful digital copy of the PDF content could be generated.

public bool FullQualityPrintPermission { get; set; }

Property Value

bool

Remarks

When it is clear (and Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions.PrintPermission is set), printing is limited to a low level representation of the appearance, possibly of degraded quality.

ModifyDocumentPermission

Indicates whether to allow to modify the contents of the document by operations other than those controlled by Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions.AnnotationsPermission, Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions.FillFormsPermission and Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions.AssembleDocumentPermission.

public bool ModifyDocumentPermission { get; set; }

Property Value

bool

OwnerPassword

Gets or sets the owner password for the encrypted PDF document.

public string OwnerPassword { get; set; }

Property Value

string

Remarks

The owner password allows the user to open an encrypted PDF document without any access restrictions specified.

PrintPermission

Indicates whether to allow to print the document.

public bool PrintPermission { get; set; }

Property Value

bool

Remarks

Possibly not at the highest quality level, depending on whether Aspose.Cells.Rendering.PdfSecurity.PdfSecurityOptions.FullQualityPrintPermission is also set.

UserPassword

Gets or sets the user password required for opening the encrypted PDF document.

public string UserPassword { get; set; }

Property Value

string

Remarks

The owner password or user password will be required to open an encrypted PDF document for viewing.

The user password can be null or empty string, in this case no password will be required from the user when opening the PDF document.

Opening the document with the correct owner password allows full access to the document.

Opening the document with the correct user password (or opening a document that does not have a user password) allows limited access as the permissions specified.