The Syncfusion .NET Word Library (DocIO) offers powerful and comprehensive APIs to convert a Word document into an image programmatically with a few lines of code and without Microsoft Word or interop dependencies. It allows you to convert an entire document into images or a single page of a Word document to provide a document preview, thumbnail, or to print it.
This sample code shows how to convert an entire document into images using the Syncfusion .NET Word Library with just few lines of code in C#.
- using Syncfusion.DocIO;
- using Syncfusion.DocIO.DLS;
- using Syncfusion.DocIORenderer;
- // Open the Word document file stream
- using (FileStream docStream = new FileStream("Template.docx", FileMode.Open, FileAccess.Read))
- {
- //Load an existing Word document
- using (WordDocument wordDocument = new WordDocument(docStream, FormatType.Docx))
- {
- //Create an instance of DocIORenderer
- using (DocIORenderer render = new DocIORenderer())
- {
- //Convert the entire Word document to images.
- Stream[] imageStreams = wordDocument.RenderAsImages();
- for (int i = 0; i < imageStreams.Length; i++)
- {
- //Save the image stream as file
- using (FileStream fileStreamOutput = File.Create("WordToImage_" + i + ".jpeg"))
- {
- imageStreams[i].CopyTo(fileStreamOutput);
- }
- }
- }
- }
- }
Convert a specific page in a Word document into an image.
Convert a specified range of pages in a Word document into images.
The built-in font substitution event allows users to choose alternate fonts from the device or upload fonts with a few lines of code.
Configure fallback fonts for Unicode text. These fallback fonts come into play when the rendering engine encounters Unicode text that lacks a corresponding glyph in the specified fonts.
Discover resources from our blog and knowledge base that enhance your efficiency in Word-to-image conversion.
Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.
Product Updates
Technical Support
Word file formats such as DOC, DOT, DOCX, DOTX, DOCM, DOTM, Word Processing 2007 XML, and Word 2003 XML Document (*.xml), as well as other formats like HTML, text, and Markdown are supported.
Yes, you can perform Word-to-image conversion in Linux and different cloud platforms like Azure, Amazon Web Services, and Google Cloud Platform using the .NET Word Library.
If required fonts aren’t installed, the Word Library uses alternatives, possibly causing differences in generated images. Refer to the Knowledge base for solutions to resolve this issue.
Yes, you can programmatically open password-protected Word documents and convert them to images using the .NET Word Library.
Yes, you can convert a specific range of pages in a Word document to images.
You can access it through the Syncfusion.DocIORenderer.Net.Core NuGet package. Detailed code samples and tutorial video are available in the documentation.
Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion® is proud to hold the following industry awards.