Skip to end of metadata
Go to start of metadata
Contents Summary

The code uses some of the objects defined in Working with Common Operations.

Working with Password Protected Documents

Some document formats also support protection using a password to prevent others from changing or even opening the document. GroupDocs.Viewer also supports rendering of such documents.

The following are the steps to render password protected documents.

  • Instantiate the HtmlOptions or ImageOptions object
  • Set password using setPassword(String) method
  • Get pages

This feature is supported in both, the HTML based rendering and the image-based rendering.

The following code sample shows how to render password protected documents.

Forced Password Validation

When password protected documents are rendered with the caching enabled, the document password is validated only on the first call. All subsequent renderings will provide output without checking the document password. In order to alter this behavior and let the API to validate document password on each rendering, use setForcePasswordValidation(true) method of the ViewerConfig object as shown in the code sample below.

  • No labels