Convert Word DOC to PNG, JPEG, or BMP in C#

Often you need to embed the pages of an MS Word document into your application programmatically. One of the most commonly used methods for such cases is the conversion of Word documents to image formats. In this article, you will learn how to convert Word DOC or DOCX files to PNG, JPEG, BMP, GIF, or TIFF images using C# .NET. Furthermore, we will demonstrate how to control the Word to image conversion using different options.

C# .NET API for Word DOC to Image Conversion

Aspose.Words for .NET is a powerful API that allows you to create MS Word documents from scratch. Moreover, it lets you manipulate the existing Word documents for encryption, conversion, text extraction, etc. We will use this API to convert Word documents to image formats. You can download the API’s DLL or install it directly from NuGet.

PM> Install-Package Aspose.Words

C# Convert a Word DOC to PNG, JPEG, BMP, GIF, or TIFF

Aspose.Words for .NET makes it quite easier for you to convert a Word DOC/DOCX to desired image format. You can set the output image format as PNG, JPEG, BMP, GIF, or TIFF using SaveFormat enum. For demonstration, let’s convert a Word DOCX to a PNG image in C#.

The following code sample shows how to convert a Word DOCX to PNG images in C#.

Control DOC/DOCX to Image Conversion in C#

You can also control the Word to image conversion using different options. For example, you can set horizontal resolution, vertical resolution, overall resolution, scale, pixel format, brightness, color mode, contrast, and paper color. The following are the steps to customize Word to image conversion in C#.

The following code sample shows how to control Word to JPEG image conversion using different options.

Get a Free API License

You can get a temporary license in order to use Aspose.Words for .NET without evaluation limitations.

Conclusion

In this article, you have learned how to convert Word documents to PNG, JPEG, BMP, GIF, or TIFF images in C#. Moreover, you have seen how to control Word to image conversion using different options. Apart from that, you can explore other features offered by Aspose.Words for .NET using the documentation. Also, you can post your questions on our forum.

See Also