Created
November 11, 2024 19:31
-
-
Save conholdate-gists/f97d0cb86776761c3f9f1c207169564f to your computer and use it in GitHub Desktop.
Password Protect PowerPoint Presentation in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
com.aspose.slides.Presentation presentation = new com.aspose.slides.Presentation("pres.pptx"); | |
try { | |
presentation.getProtectionManager().encrypt("123123"); | |
presentation.save("encrypted-pres.pptx", com.aspose.slides.SaveFormat.Pptx); | |
} finally { | |
if (presentation != null) presentation.dispose(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
com.aspose.slides.Presentation pres = new com.aspose.slides.Presentation(); | |
try { | |
pres.getProtectionManager().setReadOnlyRecommended(true); | |
pres.save(dataDir + "ReadOnlyPresentation.pptx", com.aspose.slides.SaveFormat.Pptx); | |
} finally { | |
if (pres != null) pres.dispose(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
com.aspose.slides.Presentation presentation = new com.aspose.slides.Presentation(); | |
try { | |
presentation.getProtectionManager().setWriteProtection("123123"); | |
presentation.save(dataDir + "write-protected-pres.pptx", com.aspose.slides.SaveFormat.Pptx); | |
} finally { | |
if (presentation != null) presentation.dispose(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment