翻譯|使用教程|編輯:胡濤|2022-05-06 14:14:44.293|閱讀 330 次
概述:本文演示了如何使用 Spire.Doc 將數字簽名添加到 Word 文檔,歡迎查閱!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
本文演示了如何使用 Spire.Doc 將數字簽名添加到 Word 文檔。
Spire.Doc 為我們提供了以下方法來為 Word 文檔添加數字簽名:
在下面的示例中,我們將看到如何將數字簽名添加到 Word 文檔,并使用帶有 Document 對象的SaveToFile方法將結果保存到文件中。
//Load the Word document Document doc = new Document("sample.docx"); //Sign the document with certificate and save to file doc.SaveToFile("AddDigitalSignature.docx", FileFormat.Docx2013, "gary.pfx", "e-iceblue");
我們還可以將數字簽名添加到 Word 文檔,并使用帶有 Document 對象的SaveToStream方法將結果保存到流中 。
//Load the Word document Document doc = new Document("sample.docx"); //Create a FileStream FileStream fs = new FileStream(); //Sign the document with certificate and save to stream doc.SaveToStream(fs, FileFormat.Docx2013, "gary.pfx", "e-iceblue"); fs.Flush();
下面的示例演示如何使用帶有 Document 類的 Sign 方法將數字簽名添加到 Word 文檔。
//Read the Word document into a FileStream FileStream fs = File.OpenRead("sample.docx"); //Sign the document using Sign method with Document class byte[] result = Document.Sign(fs, "gary.pfx", "e-iceblue"); File.WriteAllBytes("AddDigitalSignature.docx", result); fs.Flush();
輸出文件:
歡迎下載|體驗更多E-iceblue產品
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn