public bool CanConvertTo(
DocumentFormat outputFormat,
DocumentEngine? engine = null
)
Public Function CanConvertTo (
outputFormat As DocumentFormat,
Optional engine As DocumentEngine? = Nothing
) As Boolean
Create an instance of DocumentConverter class with an input document and call instance methods ConvertTo and CanConvertTo. This is useful especially when you want to convert the same input document to several output formats:
var documentConverter = new DocumentConverter(@"c:\SomeFolder\InputFile.docx");
// CanConvertTo determines document format from the extension in file name.
// So it does not read the file to check if it's a valid Docx file.
if (documentConverter.CanConvertTo(DocumentFormat.Pdf))
documentConverter.ConvertTo(DocumentFormat.Pdf);
// This check is same as above
if (documentConverter.CanConvertTo("OutputFile.pdf"))
documentConverter.ConvertTo(DocumentFormat.Pdf);
Dim documentConverter As New DocumentConverter("c:\SomeFolder\InputFile.docx")
' CanConvertTo determines document format from the extension in file name.
' So it does not read the file to check if it's a valid Docx file.
If documentConverter.CanConvertTo(DocumentFormat.Pdf) Then
documentConverter.ConvertTo(DocumentFormat.Pdf)
End If
' This check is same as above
If documentConverter.CanConvertTo("OutputFile.pdf") Then
documentConverter.ConvertTo(DocumentFormat.Pdf)
End If