.NET Word Examples
- Create Word Document
- Perform Mail Merge
- Manage Bookmarks
- Find and Replace Text
- Format Tables
- Split Word Documents
- Merge Multiple Word Documents
- Fill and Manage Form Fields
- Generate and Update Table of Contents
- Compare Word Documents
- Encrypt and Decrypt Documents with Password
- Convert Word Documents to PDF
- Convert Word Documents to Images
- Word-HTML Conversions
- Word-Markdown Conversions
- Word-Text Conversions
Word to Image Conversion Using the Syncfusion .NET Word Library
The Syncfusion® .NET Word Library offers 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 individual pages or the entire document into images.
Watch this video to learn how to convert a Word document to images using the Syncfusion .NET Word Library.
Convert Word to images using C#
Learn how to convert Word documents to images programmatically using C# with the Syncfusion .NET Word Library. This guide demonstrates converting individual pages or entire documents into image formats.
Step 1: Create a new project
Start by creating a new C# Console Application project.
Step 2: Install the NuGet package
Add the Syncfusion.DocIORenderer.Net.Core package to your project from NuGet.org.
Step 3: Add required namespaces to convert Word to images
Add the following namespaces to your Program.cs file:
using System.IO;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;Step 4: Open the Word document
Open an existing Word document for conversion to images.
FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open);
//Load an existing Word document
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Automatic);Step 5: Convert Word document page to image
Create a DocIORenderer instance and convert the first page of the Word document into an image stream.
//Create an instance of DocIORenderer
DocIORenderer renderer = new DocIORenderer();
//Convert the first page of the Word document into an image
Stream imageStream = wordDocument.RenderAsImages(0, ExportImageFormat.Jpeg);Step 6: Save the output image
Save the converted image stream to an output file.
//Create the output image file stream
FileStream fileStreamOutput = File.Create(Path.GetFullPath(@"Output/Output.jpeg"));
//Copy the converted image stream into created output stream
imageStream.CopyTo(fileStreamOutput);
// Close resources explicitly
fileStreamOutput.Close();
imageStream.Close();
wordDocument.Close();
fileStream.Close();GitHub project
NuGet installation
Get started quickly by downloading the installer and checking license information on the Downloads page.
Table of contents
Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.
Learning
Technical Support
