Add password to PDF with permissions

You can easy protect PDF document with permissions, using the “GroupDocs.Merger for .NET” product.

The following example demonstrates how to secure PDF document with permissions in C# code:

string filePath = @"c:\sample.pdf";
string filePathOut = @"c:\output\result.pdf";

PdfSecurityOptions pdfSecurityOptions = new PdfSecurityOptions("SAMPLE_PASSWORD");
pdfSecurityOptions.Permissions = PdfSecurityPermissions.DenyModification;

using (Merger merger = new Merger(filePath))
{
    merger.AddPassword(pdfSecurityOptions);
    merger.Save(filePathOut);
}
Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.