Load file from local disk

To load the source file from a local disk, use the following implementations of the Converter class constructor:

All these constructors have the filePath string parameter which specifies the location of the source file. File path can be absolute or relative. If the source file does not exist, an exception occurs.

GroupDocs.Conversion will open the file for reading only when any other methods of the Converter class are called.

The following code snippet shows how to load a file from 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 FluentConverter.Load(string fileName) and FluentConverter.Load(string[] fileName) fluent syntax methods to load the source file from 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();
}