GroupDocsGists
10/24/2017 - 1:22 PM

Examples-GroupDocs.Conversion.Examples.Java-src-main-java-com-groupdocs-conversion-examples-Conversion-convertProtectedFilesToWordAsStream.java

// For complete examples and data files, please go to https://github.com/groupdocs-conversion/GroupDocs.Conversion-for-Java
// Instantiating the conversion handler
ConversionHandler conversionHandler = new ConversionHandler(Utilities.getConfiguration());

// Set password to unprotect protected document during loading
LoadOptions loadOptions = new LoadOptions();
loadOptions.setPassword("secret");

// Convert file to Doc, starting from page 2 and convert 2 pages
SaveOptions saveOptions = new WordsSaveOptions();
saveOptions.setPageNumber(2);
saveOptions.setNumPagesToConvert(2);
saveOptions.setConvertFileType(WordsSaveOptions.WordsFileType.Doc);
GroupDocsInputStream convertedDocumentPath = conversionHandler.<GroupDocsInputStream> convert(fileName,
		loadOptions, saveOptions);