Current location - Quotes Website - Signature design - Java adds digital signature to Word Java method to add digital signature to Word
Java adds digital signature to Word Java method to add digital signature to Word

Java adds digital signature to Word. Java method to add digital signature to Word. A digital signature is an electronic cryptographic authentication stamp applied to digital data to confirm that the information from the signer and that the document contents have not been tampered with. This article will introduce how to use Spire.DocforJava to add digital signatures to Word documents programmatically.

Tools/Materials

IntedliJIDEA

JDK1.8.0

Jar package: spire.doc.jar4.5.1

< p>Word document: .docx2013 version

Digital certificate: .pfx and secret key

Operation method

01

1. About How to import jar

1.1 Manually download the jar package and import,

1.2 Maven warehouse download and import, the pom.xml file must be configured, as follows:

repositories

repository

idcom.e-iceblue/id

url

/repository

/repositories

dependencies

dependency

groupIde-iceblue/groupId

spire.doc

version4.5.1/version

/dependency

/dependencies

You can download and import after completing the configuration.

02

Java code:

importcom.spire.doc.*;

publicclassAddSignature{

publicstaticvoidmain (String[]args){

//Load Word document

Documentdoc=newDocument();

doc.loadFromFile("test.docx");

//Add digital signature and save the document

doc.saveToFile("AddSignature.docx",FileFormat.Docx_2013,"Cermia.pfx","123654yes!");< /p>

}

}

03

Run the program to generate a Word document.

You can view the effect of adding a signature in the picture below: