Get default load options for a source 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 load options for the source document format. This will allow you to get default load options runtime, knowing the source format.

To get default options, follow these steps:

  1. Call the static GetPossibleConversion method of the Converter class with source file extension as a parameter.
  2. From received possible conversion read the LoadOptions property.
  3. Create an instance of the Converter class and pass source document path as a constructor parameter and load options from the previous step.
  4. Instantiate the appropriate ConvertOptions class e.g. (PdfConvertOptions, WordProcessingConvertOptions, SpreadsheetConvertOptions etc.).
  5. Call the Convert method of the Converter class instance and pass filename for the converted document and the instance of ConvertOptions from the previous step.

The following code snippet shows how to get default load options for a Word processing document:

var possibleConversions = Converter.GetPossibleConversions("docx");
var loadOptions = (WordProcessingLoadOptions) possibleConversions.LoadOptions;
loadOptions.Password = "12345";

using (Converter converter = new Converter("password_protected.docx", (LoadContext loadContext) => loadOptions))
{
    var convertOptions = new PdfConvertOptions();
    converter.Convert(outputFile, convertOptions);
}