Add password to PDF with permissions
Leave feedback
View as MarkdownMarkdown
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);
}
We value your opinion. Your feedback will help us improve our documentation.