Word to Picture

Convert Word to TIFF Document in Java

There is an ever-growing need for efficient and convenient document conversion solutions. We use MS Word documents for official and personal data storage. They are also one of the popular file format for official information sharing by corporate, university and government organizations. Now, in order to prevent documents from unauthorized manipulation, we can convert Word to Image. So in this technical article, we will focus specifically on how to convert Word documents to TIFF images using Java REST API.

This article enables developers to quickly and easily integrate document conversion capabilities into their applications, making it possible to convert Word to Tiff, Word to picture, Word to image, or DOC to Tiff with just a few lines of code.

Word to Image Conversion API

Aspose.Words Cloud SDK for Java is a REST API that provides a range of document manipulation features, including the ability to convert Word documents to TIFF images. With its simple and easy-to-use interface, developers can quickly and easily implement this functionality in their Java applications, without having to worry about the complexities of document conversion. Overall, it is a powerful tool for converting Word documents to TIFF images, PDF, Word to JPG, Word to HTML, and various other supported file formats. With its straightforward API and customizable options, you can easily implement this functionality in your applications and streamline the document conversion processes.

Now, in order to use the SDK, please add following details in pom.xml of maven build type project.

<repositories> 
    <repository>
        <id>aspose-cloud</id>
        <name>artifact.aspose-cloud-releases</name>
        <url>http://artifact.aspose.cloud/repo</url>
    </repository>   
</repositories>

<dependencies>
    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-words-cloud</artifactId>
        <version>22.8.0</version>
    </dependency>
</dependencies>

Once the JDK reference has been added to project, we need to create a free account over Aspose Cloud. Now lookup for Client ID and Client Secret at Dashboard.

Convert Word to TIFF Document in Java

In this section, we are going to convert Word to Image (TIFF document) using Java code snippet. The source word document will be loaded from clouds storage and after the conversion, it will be saved in same cloud storage.

  • Firstly, create an object of WordsApi where we pass the Client ID and Client Secret as parameters.
  • Secondly, read the input Word document from the local drive using the File object.
  • Thirdly, create the UploadFileRequest instance which requires File instance as an argument.
  • Now call the method uploadFile(…) to upload the Word document to cloud storage.
  • Create an object of GetDocumentWithFormatRequest(…) while providing an input Word document name, output format value as TIFF, and the resultant file name as arguments.
  • Finally, call the method getDocumentWithFormat(…) to convert Word to Image and save the output in Cloud storage.
Word to TIFF preview

Image1:- Word to TIFF Conversion preview

The sample Word document used in the above example can be downloaded from test_multi_pages.docx and the resultant TIFF document from Converted.tiff.

Word into Picture using cURL Commands

In this section, we are going to use the cURL commands for Word into Picture conversion. Now, the first step is to generate a JWT access token while executing the following command.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Once we have JWT token, please the following command to load Word document from cloud storage and save into TIFF document. The resultant TIFF is also stored in cloud storage.

curl -v -X GET "https://api.aspose.cloud/v4.0/words/Resultant.docx?format=TIFF&outPath=converted.tiff" \
-H  "accept: application/octet-stream" \
-H  "Authorization: Bearer <JWT Token>"

Conclusion

In conclusion, converting Word documents to TIFF images is a crucial task for many developers, and the Aspose.Words Cloud SDK for Java makes this task easier than ever before. With its powerful REST API and customizable options, developers can quickly and easily integrate document conversion capabilities into their Java applications. Whether you need to convert a single document or a large batch of documents, Aspose.Words Cloud SDK for Java provides a reliable and efficient solution for converting Word to TIFF images. So, if you are looking for a robust and user-friendly document conversion solution for your Java application, then Aspose.Words Cloud SDK for Java is definitely worth exploring.

Also, the complete source code of the SDK is published on GitHub and can be downloaded for free. You may also consider accessing the API within a web browser through SwaggerUI. Lastly, in case you encounter any issues while using the APIs, please feel free to contact us via the product support forum.

We highly recommend visiting the following links to learn more about: