View Password Protected Documents
Contents
[
Hide
]
View Password Protected Documents in C#
GroupDocs.Viewer for .NET (which is a part of Conholdate.Total for .NET) Provides you a facility to view the password protected documents.
The following are the steps to convert encrypted documents:
- Instantiate the HtmlViewOptions (or PngViewOptions, or JpgViewOptions, or PdfViewOptions) object;
- Set password in LoadOptions.Password property;
- Call View method.
The following code sample shows how to convert encrypted documents:
LoadOptions loadOptions = new LoadOptions();
loadOptions.Password = "123456";
using (Viewer viewer = new Viewer("encrypted.docx", loadOptions))
{
HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
viewer.View(viewOptions);
}
In case the password is not specified GroupDocs.Viewer will throw PasswordRequiredException.