Converter.Convert

Converter Convert method. Converts the given input document into the output document using specified input output file names and its extensions.

Convert(string, string)

Converts the given input document into the output document using specified input output file names and its extensions.

public static void Convert(string inputFile, string outputFile)
ParameterTypeDescription
inputFileStringThe input file name.
outputFileStringThe output file name.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

Examples

Shows how to convert DOCX document to PDF.

Converter.Convert(MyDir + "Simple.docx", ArtifactsDir + "Converter.ConvertToPdf.pdf");

See Also


Convert(string, string, SaveFormat)

Converts the given input document into the output document using specified input output file names and the final document format.

public static void Convert(string inputFile, string outputFile, SaveFormat saveFormat)
ParameterTypeDescription
inputFileStringThe input file name.
outputFileStringThe output file name.
saveFormatSaveFormatThe save format.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.

Examples

Shows how to convert DOCX document to XPS.

Converter.Convert(MyDir + "Simple.docx", ArtifactsDir + "Converter.ConvertToXps.Xps", SaveFormat.Xps);

See Also


Convert(Stream, Stream, SaveFormat)

Converts the given input document into a single output document using specified input and output streams.

public static void Convert(Stream inputStream, Stream outputStream, SaveFormat saveFormat)
ParameterTypeDescription
inputStreamStreamThe input stream.
outputStreamStreamThe output stream.
saveFormatSaveFormatThe save format.

Remarks

If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.

If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.

Examples

Shows how to convert DOCX document to DOC using streams.

using (Stream input = File.OpenRead(MyDir + "Simple.docx"))
using (Stream output = File.Create(ArtifactsDir + "Converter.ConvertToDocStream.doc"))
{
    Converter.Convert(input, output, SaveFormat.Doc);
}

See Also