Security

Security (2)

Mark as Final means that the presentation slide is final edition and the author doesn’t want any changes on the document. With Spire.Presentation for Java, we can protect the presentation slides by setting the password. This article demonstrates how to mark a presentation as final by setting the document property MarkAsFinal as true.

import com.spire.presentation.FileFormat;
import com.spire.presentation.Presentation;

public class MarkAsFinal {
    public static void main(String[] args) throws Exception {

        //Create a PPT document and load file
        Presentation presentation = new Presentation();
        presentation.loadFromFile("Sample.pptx");
       
        //Set the document property MarkAsFinal as true
        presentation.getDocumentProperty().set("_MarkAsFinal", true);

        //Save the document to file
        presentation.saveToFile("output/MarkasFinal.pptx", FileFormat.PPTX_2010);
    }
}

Effective screenshot after mark as final for presentation:

Java protect presentation slides by setting the property with mark as final

Tuesday, 25 December 2018 06:40

Protect presentation slides in Java

Written by support iceblue

Spire.Presentation for Java enables developers to encrypt the PowerPoint files with password, set write protection to make the presentation read only, modify the password and decrypted the presentation slides. This article will show you how to protect the presentation slides in Java applications as below:

  • Encrypt the presentation slides
  • Set the presentation slides read only
  • Decrypt the presentation slides
  • Load an encrypted PowerPoint document and modify its password

Encrypt PowerPoint file

Presentation presentation = new Presentation();
presentation.loadFromFile("C:\\Users\\Administrator\\Desktop\\Sample.pptx");

presentation.encrypt("e-iceblue");

presentation.saveToFile("output/Encrypted.pptx", FileFormat.PPTX_2010);

Protect presentation slides in Java

Set the presentation slides read only

Presentation presentation = new Presentation();
presentation.loadFromFile("C:\\Users\\Administrator\\Desktop\\Sample.pptx");

presentation.protect("123456");

presentation.saveToFile("output/Readonly.pptx", FileFormat.PPTX_2010);

Protect presentation slides in Java

Remove Encryption on Password-Protected PowerPoint File

Presentation presentation = new Presentation();
//load the encrypted document with password
presentation.loadFromFile("C:\\Users\\Administrator\\Desktop\\Encrypted.pptx", FileFormat.PPTX_2010,"e-iceblue");

//Remove encryption
presentation.removeEncryption();

presentation.saveToFile("output/Decrypted.pptx", FileFormat.PPTX_2010);

Modify the password of the protected PowerPoint document

Presentation presentation = new Presentation();

//load the encrypted document with password
presentation.loadFromFile("C:\\Users\\Administrator\\Desktop\\Encrypted.pptx", FileFormat.PPTX_2010,"e-iceblue");

//Remove the Encryption
presentation.removeEncryption();
//Set the new password to encrypt the document
presentation.encrypt("Newpass");

presentation.saveToFile("output/Modifypass.pptx", FileFormat.PPTX_2010);