Get possible conversions

GroupDocs.Conversion allows to get possible conversions for a provided source document by following the below steps:

  • Create new instance of Converter class by passing source document path as constructor’s parameter
  • Call GetPossibleConversions method of converter object

The following code sample demonstrates how to get possible conversions of the source document:

String sourceFile = "sample.docx";
Converter converter = new Converter(sourceFile);

PossibleConversions conversions = converter.getPossibleConversions();

System.out.print(String.format("%s is of type %s and could be converted to:\n",
        Constants.SAMPLE_DOCX, conversions.getSource().getExtension()));

for (Pair<FileType, Boolean> conversion : conversions.getAll()) {
    System.out.print(String.format("\t %s as %s conversion.\n", conversion.getKey().getExtension(), conversion.getValue() ? "primary" : "secondary"));

© Aspose Pty Ltd 2001-2022. All Rights Reserved.