IProtectionManager

public interface IProtectionManager

Presentation password protection management.

Methods

MethodDescription
getEncryptDocumentProperties()This property makes sense, if presentation is password protected.
setEncryptDocumentProperties(boolean value)This property makes sense, if presentation is password protected.
isEncrypted()Gets a value indicating whether this instance is encrypted.
isOnlyDocumentPropertiesLoaded()This property makes sense, if presentation file is password protected and document properties of this file are public.
isWriteProtected()Gets a value indicating whether this presentation is write protected.
getEncryptionPassword()Returns encryption password.
getReadOnlyRecommended()Gets or sets read-only recommendation.
setReadOnlyRecommended(boolean value)Gets or sets read-only recommendation.
encrypt(String encryptionPassword)Encrypts Presentation with specified password.
removeEncryption()Removes the encryption.
setWriteProtection(String password)Set write protection for this presentation with specified password.
removeWriteProtection()Removes write protection for this presentation.
checkWriteProtection(String password)Determines whether a presentation is a password protected to modify.

getEncryptDocumentProperties()

public abstract boolean getEncryptDocumentProperties()

This property makes sense, if presentation is password protected. If true then document properties is encrypted in presentation file. If false then document properties is public while presentation is encrypted. Read/write boolean.

Returns: boolean

setEncryptDocumentProperties(boolean value)

public abstract void setEncryptDocumentProperties(boolean value)

This property makes sense, if presentation is password protected. If true then document properties is encrypted in presentation file. If false then document properties is public while presentation is encrypted. Read/write boolean.

Parameters:

ParameterTypeDescription
valueboolean

isEncrypted()

public abstract boolean isEncrypted()

Gets a value indicating whether this instance is encrypted. Read-only boolean.

Value: true if presentation was loaded from encrypted file or #encrypt(String).encrypt(String) method was called ; otherwise, false.

Returns: boolean

isOnlyDocumentPropertiesLoaded()

public abstract boolean isOnlyDocumentPropertiesLoaded()

This property makes sense, if presentation file is password protected and document properties of this file are public. Value of true means that only document properties are loaded from an encrypted presentation file without use of password. Value of false means that entire encrypted presentation is loaded with use of right password, not only document properties are loaded. If presentation isn’t encrypted then property value is always false. If document properties of an encrypted file aren’t public then property value is always false. If PresentationEx.EncryptDocumentProperties is true than IsOnlyDocumentPropertiesLoaded property value is always false. Read-only boolean.

Returns: boolean

isWriteProtected()

public abstract boolean isWriteProtected()

Gets a value indicating whether this presentation is write protected. Read-only boolean.

Returns: boolean

getEncryptionPassword()

public abstract String getEncryptionPassword()

Returns encryption password. Read-only String.

Returns: java.lang.String

getReadOnlyRecommended()

public abstract boolean getReadOnlyRecommended()

Gets or sets read-only recommendation. Read/write boolean.


Presentation pres = new Presentation();
 pres.getProtectionManager().setReadOnlyRecommended(true);
 pres.save("ReadOnlyPresentation.pptx", SaveFormat.Pptx);

Returns: boolean

setReadOnlyRecommended(boolean value)

public abstract void setReadOnlyRecommended(boolean value)

Gets or sets read-only recommendation. Read/write boolean.


Presentation pres = new Presentation();
 pres.getProtectionManager().setReadOnlyRecommended(true);
 pres.save("ReadOnlyPresentation.pptx", SaveFormat.Pptx);

Parameters:

ParameterTypeDescription
valueboolean

encrypt(String encryptionPassword)

public abstract void encrypt(String encryptionPassword)

Encrypts Presentation with specified password.

Parameters:

ParameterTypeDescription
encryptionPasswordjava.lang.StringThe password.

removeEncryption()

public abstract void removeEncryption()

Removes the encryption.

setWriteProtection(String password)

public abstract void setWriteProtection(String password)

Set write protection for this presentation with specified password.

Parameters:

ParameterTypeDescription
passwordjava.lang.StringThe password.

removeWriteProtection()

public abstract void removeWriteProtection()

Removes write protection for this presentation.

checkWriteProtection(String password)

public abstract boolean checkWriteProtection(String password)

Determines whether a presentation is a password protected to modify.


Presentation presentation = new Presentation(presentationFilePath);
 try {
     boolean isWriteProtected = presentation.getProtectionManager().checkWriteProtection("my_password");
 } finally {
     if (presentation != null) presentation.dispose();
 }

Parameters:

ParameterTypeDescription
passwordjava.lang.StringThe password for checking.

  1. You should check the (#isWriteProtected.isWriteProtected) property before calling this method. 2. When the password is null or empty, this method returns false. |

Returns: boolean - True if the password is valid; otherwise, false.