Spire.PDF 教程:从加密的PDF文档中删除密码

使用Spire.PDF for .NET,我们可以轻松地加密PDF文档,同时我们还可以使用Spire.PDF从C#和VB.NET中的加密PDF文档中删除密码,我们需要通过调用方法PdfDocument.LoadFromFile(string filename,string password)加载加密的PDF文件,然后将密码设置为空,以删除密码。

首先,用用户密码查看PDF:

图片1

Step 1:加载受密码保护的PDF文档。

PdfDocument pdf = new PdfDocument();pdf.LoadFromFile("Sample.pdf", "e-iceblue");

Step 2:将密码设置为空,以删除用户密码。

pdf.Security.UserPassword = string.Empty;

Step 3:将文档保存到文件。

pdf.SaveToFile("Decrypted.pdf");

从PDF文档中删除密码后的有效屏幕截图:

图片2

完整代码:

[C#]

PdfDocument pdf = new PdfDocument();pdf.LoadFromFile("Sample.pdf", "e-iceblue");pdf.Security.UserPassword = string.Empty;pdf.SaveToFile("Decrypted.pdf");

[VB.NET]

Dim pdf As New PdfDocument()pdf.LoadFromFile("Sample.pdf", "e-iceblue")pdf.Security.UserPassword = String.Emptypdf.SaveToFile("Decrypted.pdf")

控件

标签:文档管理PDF文档处理

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

上一篇 2017年7月12日
下一篇 2017年7月12日

相关推荐

发表回复

登录后才能评论