# Protect PPTX Presentation Files using Java

> Protect PPTX presentations in Java. Use Aspose.Slides for Java to encrypt presentation files and set write protection.

Source: https://products.aspose.com/slides/java/protect/pptx/
Updated: 2026-07-09



## Protecting a PPTX Presentation via Java

Using [Aspose.Slides for Java](/slides/java/), you can protect a PPTX 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 a PPTX Presentation using Java

```java
Presentation presentation = new Presentation("presentation.pptx");
try {
    presentation.getProtectionManager().encrypt("123123");
    presentation.save("encrypted-presentation.pptx", SaveFormat.Pptx);
} finally {
    presentation.dispose();
}
```

### Set Write Protection for a PPTX Presentation using Java

```java
Presentation presentation = new Presentation("presentation.pptx");
try {
    presentation.getProtectionManager().setWriteProtection("123123");
    presentation.save("write-protected-presentation.pptx", SaveFormat.Pptx);
} finally {
    presentation.dispose();
}
```

## How to Password Protect PPTX via Java

These are the steps to protect PPTX files.

Load the `PPTX` file with the `Presentation` class.

Call the `encrypt` method or the `setWriteProtection` method from the `ProtectionManager` object.

Save the protected presentation in PPTX format.

## Other Supported Protect Formats
