TIFF (Tagged Image File Format) is a flexible file format for storing raster graphics images. It's popular and widely supported by image-manipulation, scanning, faxing and word processing applications etc. The ability to store image data in a lossless format makes a TIFF file to be a useful image archive. In some cases, developers may need to convert documents in other format like Word to TIFF. In this article, we will describe how to achieve this task in Java using Spire.Doc for Java.
Install Spire.Doc for Java
First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.
<repositories> <repository> <id>com.e-iceblue</id> <name>e-iceblue</name> <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url> </repository> </repositories> <dependencies> <dependency> <groupId>e-iceblue</groupId> <artifactId>spire.doc</artifactId> <version>12.10.3</version> </dependency> </dependencies>
Convert Word to TIFF
Spire.Doc for Java provides the Document.saveToTiff() method for converting Word to TIFF. This method accepts a String parameter which specifies the file path of the converted TIFF.
You can follow the steps below to convert a Word document to TIFF format:
- Create a Document instance.
- Load a Word document using Document.loadFromFile() method.
- Save the document to TIFF using Document.saveToTiff() method.
- Java
import com.spire.doc.Document; public class ConvertWordToTiff { public static void main(String[] args){ //Create a Document instance Document document = new Document(); //Load a Word document document.loadFromFile("Sample.docx"); //Save the document as multi-page TIFF document.saveToTiff("toTIFF.tiff"); } }
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.