Get default convert options for a target format

GroupDocs.Conversion allows you to get default predefined convert options for a desired target document format. This will allow you to get predefined convert options runtime, knowing the desired target format.

To get default convert options, follow these steps:

  1. Create an instance of Converter class and pass source document path as a constructor parameter.
  2. Invoke the GetPossibleConversions converter method.
  3. Use the file type or file extension indexer of the received possible conversion and read the ConvertOptions property.
  4. Call the Convert method of the Converter class instance and pass the filename of the converted document and the instance of ConvertOptions from the previous step.

The following code snippet shows how to get predefined convert options for a desired target format:

using (Converter converter = new Converter("sample.docx"))
{
    var possibleConversion = converter.GetPossibleConversions();
    var convertOptions = possibleConversion["pdf"].ConvertOptions;
    converter.Convert(outputFile, convertOptions);
}