Get default convert options for a target format

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Conversion MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-conversion -- dnx GroupDocs.Conversion.Mcp --yes
Folders, licensing and more →

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);
}