Get default ConvertOptions for specific target format

GroupDocs.Conversion allows to get default convert options for specific target format 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
  • Use the file extension or FileType as key to indexer of object received as value in previous step

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

using (var converter = new Converter("source.docx"))
    var possibleConversions = converter.GetPossibleConversions();
    var targetConversion = possibleConversions["pdf"];
    var convertOptions = targetConversion?.ConvertOptions;
    if (convertOptions != null)
        converter.Convert("converted.pdf", convertOptions);