翻譯|使用教程|編輯:李顯亮|2021-05-13 10:24:30.173|閱讀 403 次
概述:本文演示了如何使用Spire.Presentation for .NET在C#和VB.NET中向PowerPoint文檔添加數字簽名或刪除PowerPoint文檔中的現有數字簽名。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Spire.Presentation for .NET 是專業的 PowerPoint組件,開發者可以在 .NET 平臺上對 PPT文檔進行生成、修改、轉換和打印等操作,而無需安裝 Microsoft PowerPoint。
本文演示了如何使用Spire.Presentation for .NET在C#和VB.NET中向PowerPoint文檔添加數字簽名或刪除PowerPoint文檔中的現有數字簽名。可點擊此處下載最新版測試。
添加數字簽名
C#
using Spire.Presentation; using System; using System.Security.Cryptography.X509Certificates; namespace AddDigitalSignature { class Program { static void Main(string[] args) { //Create a Presentation instance Presentation ppt = new Presentation(); //Load a PowerPoint document ppt.LoadFromFile("Input.pptx"); //Add digital signature X509Certificate2 x509 = new X509Certificate2("gary.pfx", "e-iceblue"); ppt.AddDigitalSignature(x509, "e-iceblue", DateTime.Now); //Save the result document ppt.SaveToFile("AddDigitalSignature.pptx", FileFormat.Pptx2013); } } }
VB.NET
Imports Spire.Presentation Imports System Imports System.Security.Cryptography.X509Certificates Namespace AddDigitalSignature Class Program Private Shared Sub Main(ByVal args As String()) Dim ppt As Presentation = New Presentation() ppt.LoadFromFile("Input.pptx") Dim x509 As X509Certificate2 = New X509Certificate2("gary.pfx", "e-iceblue") ppt.AddDigitalSignature(x509, "e-iceblue", DateTime.Now) ppt.SaveToFile("AddDigitalSignature.pptx", FileFormat.Pptx2013) End Sub End Class End Namespace
效果圖:
刪除數字簽名
C#
using Spire.Presentation; using System; using System.Security.Cryptography.X509Certificates; namespace RemoveDigitalSignature { class Program { static void Main(string[] args) { //Create a Presentation instance Presentation ppt = new Presentation(); //Load a PowerPoint document ppt.LoadFromFile("AddDigitalSignature.pptx"); //Detect if the document is digitally signed if (ppt.IsDigitallySigned == true) { //Remove the digital signature ppt.RemoveAllDigitalSignatures(); } //Save the result document ppt.SaveToFile("RemoveDigitalSignature.pptx", FileFormat.Pptx2013); } } }
VB.NET
Imports Spire.Presentation Imports System Imports System.Security.Cryptography.X509Certificates Namespace RemoveDigitalSignature Class Program Private Shared Sub Main(ByVal args As String()) Dim ppt As Presentation = New Presentation() ppt.LoadFromFile("AddDigitalSignature.pptx") If ppt.IsDigitallySigned = True Then ppt.RemoveAllDigitalSignatures() End If ppt.SaveToFile("RemoveDigitalSignature.pptx", FileFormat.Pptx2013) End Sub End Class End Namespace
效果圖:
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn