文檔金喜正規買球>>Spire.Doc系列教程>>Spire.Doc功能演示:在 Java 中為 Word 添加數字簽名
Spire.Doc功能演示:在 Java 中為 Word 添加數字簽名
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); } }
輸出結果
