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

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

C# API to Convert DOC/DOCX to PNG

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 DOC/DOCX files to PNG. You can download the API’s DLL or install it directly from NuGet.

PM> Install-Package Aspose.Words

Convert DOC to PNG in C#

Aspose.Words for .NET makes it quite easier for you to convert a DOC/DOCX to desired image format. You can set the output image format as PNG, JPEG, BMP, GIF, or TIFF using SaveFormat enum. The following are the steps to convert DOC/DOCX to PNG image in C#.

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

C# DOCX to PNG - Customization

You can also control the DOC to PNG 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 DOC to PNG conversion in C#.

The following code sample shows how to control C# DOC to PNG conversion using different options.

C# DOC to PNG Converter - Get a Free 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 DOC/DOCX to PNG images in C#. Moreover, you have seen how to control DOC to PNG 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