PowerPoint documents signed with digital signatures can help recipients check if they have been altered since they were signed. If any changes are made, the signatures will become invalid immediately. Therefore, before you edit a PowerPoint document, you should check if it has been digitally signed or not. In this article, you will learn how to achieve this task programmatically in Java using Spire.Presentation for Java.
Install Spire.Presentation for Java
First of all, you're required to add the Spire.Presentation.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.
<repositories> <repository> <id>com.e-iceblue</id> <name>e-iceblue</name> <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url> </repository> </repositories> <dependencies> <dependency> <groupId>e-iceblue</groupId> <artifactId>spire.presentation</artifactId> <version>9.11.3</version> </dependency> </dependencies>
Verify if a PowerPoint Document is Digitally Signed
Spire.Presentation for Java provides the Presentation.isDigitallySigned() method to detect if a PowerPoint document is digitally signed or not. If the method returns true, then it means the document is digitally signed.
The following are the detailed steps to implement this function:
- Create a Presentation instance.
- Load a PowerPoint document using Presentation.loadFromFile() method.
- Detect if the document is digitally signed or not using Presentation.isDigitallySigned() method.
- Java
import com.spire.presentation.Presentation; public class VerifyIfPPTisDigitallySigned { public static void main(String []args) throws Exception { //Create a Presentation instance Presentation ppt = new Presentation(); //Load a PowerPoint document ppt.loadFromFile("Sample.pptx"); //Verify if the document is digitally signed or not if (ppt.isDigitallySigned()) { System.out.println("This document is digitally signed"); } else { System.out.println("This document is not digitally signed"); } } }
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.