We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Syncfusion Feedback

Syncfusion is trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

The Syncfusion .NET PDF Library offers various encryption standards to protect PDF documents from unauthorized access. Users can effortlessly integrate this library into their applications to secure PDFs with different levels of encryption. The library complies with the enhanced security features of PDF 2.0, providing AES (Advanced Encryption Standard) 256 Revision 6 with Unicode password support.

This security works seamlessly across platforms, including Windows, macOS, Linux, Android, and iOS, through any .NET-based application, such as ASP.NET Core, ASP.NET MVC, Blazor, .NET MAUI, Xamarin, WinForms, WPF, and WinUI.

How to protect PDF documents in C#

The following code demonstrates how to protect a PDF document using C#.

using Syncfusion.Pdf.Security;
using Syncfusion.Pdf.Parsing;
// Load the PDF document from a file stream
using (FileStream inputFileStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read))
{
    // Load the PDF document
    PdfLoadedDocument document = new PdfLoadedDocument(inputFileStream);
    //  Gets a security object for the document
    PdfSecurity security = document.Security;
    // Configure key size and encryption algorithm
    security.KeySize = PdfEncryptionKeySize.Key256Bit;
    security.Algorithm = PdfEncryptionAlgorithm.AES;
    // Assign owner and user passwords
    security.OwnerPassword = "owner123";
    security.UserPassword = "user123";
    // Save the PDF document in to a file stream
    using (FileStream outputFileStream = new FileStream("Output.pdf", FileMode.Create))
    {
        document.Save(outputFileStream);
    }
    // Close the document
    document.Close(true);
}

Key features of PDF protection

Explore key functionalities, including encryption algorithms, user and permission passwords, customizable document permissions, and more to protect your PDF files.

Encryption algorithms in .NET PDF.

Encryption algorithms

The Syncfusion PDF Library provides support for basic and advanced encryption standards. The following are the encryption standards supported: - RC4 40-bit - RC4 128-bit - AES 128-bit - AES 256-bit Revision 5 - AES 256-bit Revision 6 (PDF 2.0)

Protect with permission password in .NET PDF.

Protect with permission password

A permission or master password is used to set access rights for document restrictions. Only users with the master password can edit the encrypted document.

Protect with user password in .NET PDF.

Protect with user password

A user password, also known as a document open password, is required for users to open and view the document.

Document permissions in .NET PDF.

Document permissions

By customizing the document permission settings, you can control whether users are allowed to perform specific actions such as copying content, printing, editing the document, filling form fields, and more. Additionally, you can change or remove PDF permissions and passwords.

Encryption Options in .NET PDF.

Encryption Options

The Syncfusion PDF Library lets users encrypt a PDF document as follows: - Encrypt all contents: All contents of the document will be encrypted. - Encrypt all contents except metadata: All contents of the document will be encrypted except metadata. - Encrypt only attachments: Encrypts only the file attachments, rest of the document will be left unencrypted. - Encrypt the PDF document.

Removing password security from a PDF file in .NET PDF.

Removing Password Security from a PDF File

This process involves disabling the password protection on a PDF file, making it accessible without the need to enter a password. This can be useful for simplifying access when the document no longer requires security restrictions. Once the password security is removed, users will be able to open, view, and perform actions on the PDF without any restrictions.

Explore resources for PDF protection

Discover valuable resources from our blog and knowledge base to encrypt PDF documents.

Secure Your PDF Documents Like a Pro using C

Blog

Secure Your PDF Documents Like a Pro using C#

Simple Steps to Encrypt and Decrypt PDF Files Using C

Blog

Simple Steps to Encrypt and Decrypt PDF Files Using C#

Protect attachments in existing PDF documents

Documentation

Protect attachments in existing PDF documents

Syncfusion .NET PDF Library Resources

Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.

Struggling to decide on the right product?

Our comprehensive competitor comparison of PDF framework will guide you to the perfect choice.

tick-mark 20+ Conversions support
tick-mark 50+ interactive demos
tick-mark 1.7M+ downloads
competitive-banner-FT-image

Frequently Asked Questions

PDF encryption is the process of securing a PDF document by encoding its contents to prevent unauthorized access. It’s important because it ensures that sensitive information remains confidential and protected from unauthorized viewing or tampering.

Yes, you can remove the encryption from existing PDF documents using Syncfusion .NET PDF Library.

Yes, you can control whether the users are allowed to perform specific actions, such as copying content, printing, editing the document, and filling form fields.

When choosing a password for encrypting a PDF, it’s important to use a combination of uppercase and lowercase letters, numbers, and special characters. Avoid using easily guessable passwords like common words or phrases.

PDF protection typically works by encrypting the contents of a PDF file, making it accessible only to users who have the correct password or decryption key. This encryption process involves encoding the document’s data using algorithms to prevent unauthorized access.

Our Customers Love Us

Having an excellent set of tools and a great support team, Syncfusion reduces customers’ development time.
Here are some of their experiences.

Rated by users across the globe

Want to create, view, and edit PDF files in C# or VB.NET?

Start a free 30-day evaluation today!
DOWNLOAD FREE TRIAL

No credit card required.

Mobile Free Evaluation Section

Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.

Scroll up icon