Load password-protected document

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

To load and convert a password-protected document, follow these steps:

  1. Create an instance of the Converter class and pass the source document path and the load options delegate as constructor parameters.
  2. Instantiate the appropriate ConvertOptions class e.g. (PdfConvertOptions, WordProcessingConvertOptions, SpreadsheetConvertOptions etc.)
  3. Call the convert method of the Converter class instance and pass the filename for the converted document and the instance of ConvertOptions from the previous step.

The following code snippet shows how to convert password-protected document:

const loadOptions = new groupdocs.conversion.WordProcessingLoadOptions()
loadOptions.setPassword("12345");

const converter = new groupdocs.conversion.Converter("sample_with_password.docx", loadOptions);
const convertOptions =  new groupdocs.conversion.PdfConvertOptions();
converter.convert("converted.pdf", convertOptions);