csharp check if pdf is protected without password

Code Example - csharp check if pdf is protected without password

                
                        using Spire.Pdf;
using System;


namespace Detect
{
    class Program
    {
        static void Main(string[] args)
        {
            PdfDocument doc = new PdfDocument();
            doc.LoadFromFile(@"C:\Users\Administrator\Desktop\Encrypted.pdf");

            bool isEncrypted = doc.IsEncrypted;
            Console.WriteLine(isEncrypted);
            Console.Read();
        }
    }
}