Load password-protected document

GroupDocs.Conversion supports conversion of documents that are protected with a password.

Here are the steps to follow to load and convert a password protected document:

The following code sample shows how to convert password protected document:

Contracts.Func<LoadOptions> getLoadOptions = () => new WordProcessingLoadOptions
{
    Password = "12345"
};
using (Converter converter = new Converter("sample_with_password.docx", getLoadOptions))
{
    PdfConvertOptions options = new PdfConvertOptions();
    converter.Convert("converted.pdf, options);
}

or can use fluent syntax

new GroupDocs.Conversion.Converter()
    .Load("sample_with_password.docx").WithOptions(() => new WordProcessingLoadOptions
            {
                Password = "12345"
            })
    .ConvertTo("converted.pdf")
    .Convert();