We can easily convert Word documents (DOC or DOCX) to raster images. Raster images are capable of rendering complex and multicolored visuals. TIFF is a popular format to store raster images. It supports saving of multiple images in the form of pages. This distinguishing feature of TIFF format makes it a suitable option to present the Word documents in a read-only format. In this article, we will learn how to convert a Word document to TIFF image using C#.
The following topics shall be covered in this article:
- C# API to Convert Word to TIFF
- Convert Word Document to TIFF in C#
- Customize Word to TIFF Conversion in C#
C# API to Convert Word to TIFF
For converting DOC to TIFF or DOCX to TIFF, we will be using Aspose.Words for .NET API. It enables us to generate, modify, convert, render and print files without utilizing Microsoft Word directly within cross-platform applications. Please either download the DLL of the API or install it using NuGet.
PM> Install-Package Aspose.Words
Convert Word Document to TIFF in C#
We can convert a Word document to a multipage TIFF by following the steps given below:
- Load a Word document using the Document class.
- Save the document as TIFF file using Save() method. It takes the path of the output file as an argument.
The following code sample shows how to convert a Word document to a TIFF using C#.
Customize Word to TIFF Conversion in C#
We can use different options to customize the conversion of Word documents to TIFF. For this purpose, the API provides the _ImageSaveOptions _class. It allows setting the image brightness, resolution, range of pages to convert, compression scheme, and so on. Please follow the steps mentioned below to set additional options while converting Word to TIFF.
- Firstly, load a Word document using the Document class.
- Next, create an instance of the ImageSaveOptions class with the input image format as an argument.
- After that, set the desired options such as TiffCompression, Resolution, etc.
- Finally, call the Save(string, ImageSaveOptions) method to convert Word to TIFF.
The following code sample shows how to convert a Word document to a TIFF image with additional options.
Get a Free License
Please try the API without evaluation limitations by requesting a free temporary license.
In this article, we have learned how to convert a Word document to a TIFF image using C#. We have also seen how to apply additional options such as TIFF compression and resolution programmatically. Besides, you can learn more about Aspose.Words for .NET API using the documentation. In case of any ambiguity, please feel free to contact us on the forum.