原創|使用教程|編輯:王香|2017-08-16 15:09:41.000|閱讀 832 次
概述:Spire.PDF 是一個專業的PDF組件,能夠獨立地創建、編寫、編輯、操作和閱讀PDF文件,本文介紹了如何通過Spire.PDF 從加密的PDF文檔中刪除密碼。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
使用Spire.PDF for .NET,我們可以輕松地加密PDF文檔,同時我們還可以使用Spire.PDF從C#和VB.NET中的加密PDF文檔中刪除密碼,我們需要通過調用方法PdfDocument.LoadFromFile(string filename,string password)加載加密的PDF文件,然后將密碼設置為空,以刪除密碼。
首先,用用戶密碼查看PDF:
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文檔中刪除密碼后的有效屏幕截圖:
完整代碼:
[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.Empty pdf.SaveToFile("Decrypted.pdf")
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn