How to Start Tutorials Troubleshooting Main Operations Convert PDF Read PDF Edit PDF PDF Report Generator Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

C# PDF File Protect Library
How to add, generate, remove PDF file permission with owner password using c# .net


Online C# Guide for How to Set PDF File Access Permissions Using XDoc.PDF for .NET in C#









  • A best PDF document SDK library for Visual Studio .NET for PDF security level settings in C#.NET framework project
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Powerful .NET components for PDF file protecting in both WinForms program and ASP.NET web application
  • Free online C# source code provides multiple ways to set PDF file permissions in C#.NET class
  • Support to create a password to PDF or delete password from PDF file
  • Help to protect PDF from printing in C#.NET
  • Help to lock and unlock PDF from copying and editing
  • Protect PDF from annotation and content extraction
  • Able to lock PDF form after filling out
  • Provide users with the ability of assembling adobe PDF document




C# apply pdf document permission settings with password


        #region apply pdf document permission settings with password
        internal static void applyPermissionSettings()
        {
            String inputFilePath = @"C:\demo.pdf";
            String outputFilePath = @"C:\demo_with_settings.pdf";

            // Create a password setting object with user password "Hello World".
            PasswordSetting passwordSetting = new PasswordSetting("Hello World");

            // Set encryption level to AES-128.
            passwordSetting.Level = EncryptionLevel.AES_128bit;

            // Printing is allowed.
            passwordSetting.IsPrint = true;

            // Print with high-resolution.
            passwordSetting.IsHighReso = true;

            // Document is allowed to be changed.
            passwordSetting.IsModify = true;

            // Annotation is allowed.
            passwordSetting.IsAnnot = true;

            // Form filling is allowed.
            passwordSetting.IsFillForm = true;

            // Content extraction is allowed.
            passwordSetting.IsExtract = true;

            // Copying is allowed.
            passwordSetting.IsCopy = true;

            // PDF document assembling is allowed.
            passwordSetting.IsAssemble = true;

            // Add password to the file.
            PDFDocument.AddPassword(inputFilePath, outputFilePath, passwordSetting);
        }
        #endregion