Save file to local disk
Leave feedback
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();
}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.