国产PDF管理控件Spire.PDF使用教程:检测PDF文件是否在C#中受密码保护

>>Spire.PDF更新至最新版v7.2,欢迎下载体验

检测PDF文件是否在C#中受密码保护

Spire.PDF提供了一个名为IsPasswordProtected(string fileName)的方法,该方法返回布尔值。如果值为true,则表示PDF已使用密码加密,否则未加密。

C#

using Spire.Pdf;using System;namespace PdfDemo{    class Program    {        static void Main(string[] args)        {            string fileName = "Sample.pdf";            bool value = PdfDocument.IsPasswordProtected(fileName);            Console.WriteLine(value);            Console.ReadKey();        }    }}

VB.NET

Imports Spire.PdfImports SystemNamespace PdfDemo     Class Program        Private Shared Sub Main(ByVal args() As String)            Dim fileName As String = "Sample.pdf"            Dim value As Boolean = PdfDocument.IsPasswordProtected(fileName)            Console.WriteLine(value)            Console.ReadKey        End Sub    End ClassEnd Namespace 

运行项目后,我们得到显示PDF文件受密码保护的输出:

国产PDF管理控件Spire.PDF使用教程:检测PDF文件是否在C#中受密码保护

是E-iceblue官方友好合作伙伴,如果您对spire.PDF感兴趣,可以联系在线客服了解具体授权价格和使用机制。
标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年1月5日
下一篇 2021年1月5日

相关推荐

发表回复

登录后才能评论