Lock or Password Protect ODP using Java
Build Java applications that protect presentation files using server-side APIs.
Protecting an ODP Presentation via Java
Using
Aspose.Slides for Java
, you can protect an ODP presentation from opening or modification by setting a password. Use the ProtectionManager object from the Presentation class to call methods such as encrypt and setWriteProtection.
Encrypt an ODP Presentation using Java
Presentation presentation = new Presentation("presentation.odp");
try {
presentation.getProtectionManager().encrypt("123123");
presentation.save("encrypted-presentation.odp", SaveFormat.Odp);
} finally {
presentation.dispose();
}Set Write Protection for an ODP Presentation using Java
Presentation presentation = new Presentation("presentation.odp");
try {
presentation.getProtectionManager().setWriteProtection("123123");
presentation.save("write-protected-presentation.odp", SaveFormat.Odp);
} finally {
presentation.dispose();
}How to Password Protect ODP via Java
Follow these steps to protect an ODP presentation.
- Load the ODP file with the
Presentationclass. - Call the
encryptmethod or thesetWriteProtectionmethod from theProtectionManagerobject. - Save the protected file with
SaveFormat.Odp.
Built with Aspose.Slides
Password-Protect ODP Files Online
The free Aspose.Slides Lock app is built with Aspose.Slides for Java, the same API as the code above. Open it and see what the API can do with your own ODP files.
- Runs in your browser, nothing to install.
- See how Aspose.Slides protects presentations before you write code.
- Set a password to open or edit your ODP file.
- Download the protected file.
Other Supported Protection Formats
Using Java, you can also protect the following formats.