翻譯|使用教程|編輯:李顯亮|2021-06-11 09:50:05.770|閱讀 637 次
概述:本文向您展示如何使用 Spire.Doc for Java 對 Word 文檔進行數字簽名。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Spire.Doc for Java 是一款專業的Java Word組件,開發人員使用它可以輕松地將Word文檔創建、讀取、編輯、轉換和打印等功能集成到自己的Java應用程序中。
本文向您展示如何使用 Spire.Doc for Java 對 Word 文檔進行數字簽名。 可點擊此處下載最新版測試。
import com.spire.doc.Document; import com.spire.doc.FileFormat; public class AddDigitalSignature { public static void main(String[] args) { //Create a Document object Document doc = new Document(); //Load the sample Word file doc.loadFromFile("C:\\Users\\Administrator\\Desktop\\Java Doc.docx"); //Specify certificate path String certificatePath = "C:\\Users\\Administrator\\Desktop\\gary.pfx"; //Specify password of the certificate String certificatePassword = "e-iceblue"; //Sign the document with certificate and save to file doc.saveToFile("AddDigitalSignature.docx", FileFormat.Docx_2013, certificatePath, certificatePassword); } }
輸出結果
Spire.Doc for Java更新至v4.5.1,該版本支持驗證文檔的保護密碼,增強了Word到PDF/HTML/SVG的轉換功能,同時還修復了加載和合并文檔等時出現的問題。具體細節如下:
新功能:
Document document = new Document(); document.loadFromFile(input); boolean checkResult = document.checkProtectionPassWord(password);
String input="input.docx"; Document doc = new Document(); doc.loadFromFile(input); String result = "AddDigitalSignature.docx"; doc.saveToFile(result, FileFormat.Docx, "gary.pfx", "e-iceblue");
整合所有格式API處理套包Spire.office for Java正在慧都網火熱銷售中!立馬1分鐘了解全部咨詢!
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn