Load password-protected document
Leave feedback
GroupDocs.Conversion supports the conversion of documents that are protected with a password.
To load and convert a password-protected document, follow these steps:
- Create an instance of the Converter class and pass the source document path and the load options delegate as constructor parameters.
- Instantiate the appropriate ConvertOptions class e.g. (PdfConvertOptions, WordProcessingConvertOptions, SpreadsheetConvertOptions, etc.)
- 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:
import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;
import com.groupdocs.conversion.options.load.WordProcessingLoadOptions;
...
WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
loadOptions.setPassword("12345");
Converter converter = new Converter("sample_with_password.docx", loadOptions);
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("converted.pdf", options);
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.