Save file to local disk

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 →

To save the conversion results to a local disk, use the Convert(string filePath, ConvertOptions convertOptions) implementation of the Convert() method. This implementation accepts the path of the output file and converter options as parameters.

File path can be absolute or relative. If the resulting file does not exist, it will be created.

The following code snippet shows how to save a file to a local disk:

public static void Run()
{
    // Specify source file location
    using (Converter converter = new Converter("c:\\files\\sample.docx")) 
    {
        PdfConvertOptions options = new PdfConvertOptions();
        // Specify output file location
        converter.Convert("c:\\files\\converted.pdf", options);
    }
}

You can also use the ConvertTo(string fileName) fluent syntax method to save a file to a local disk:

public static void Run()
{
FluentConverter
    // Specify source file location
    .Load("c:\\files\\sample.docx")
    // Specify output file location
    .ConvertTo("c:\\files\\converted.pdf")
    .Convert();
}