Word to TIFF Document

Word to TIFF Document | Convert DOC to TIFF Document online using Python

Word files are popular for reports, resumes, letters, documentation, note-taking, newsletters, and presentation preparation. Mostly it contains some text, images, objects, and creative formatting. But in order to view Word documents, we need specialized applications which may incur installation and licensing costs. But if we convert them to raster image formats, these files can be viewed on any platform. Furthermore, the conversion of word to TIFF document would be more beneficial because it’s predominantly lossless compression, meaning TIFF files retain the original image’s detail and color depth. The TIFF Document is perfect for high-quality professional photos and in this article, we are going to discuss the details on how to convert Word DOC to TIFF format using Python SDK.

In this blog, we are going to discuss the following topics in more detail:

Word Conversion API

In order to convert Word to TIFF Document, we need to use Aspose.Words Cloud SDK for Python provides the capabilities to create, edit and transform MS Word files to TIFF, HTML, PDF, EPUB, JPEG, PNG, and other supported file formats. The SDK is available for download at PIP and GitHub. So please execute the following command on the command line terminal to install the SDK:

pip install aspose-words-cloud

After installation, we need to create a free account by visiting Aspose.Cloud dashboard, so that we can manage our documents in cloud storage.

Word to TIFF Document using Python

Please follow the instructions given below to load the Word document from cloud storage and convert it to a TIFF image. After the conversion, the resultant file will be saved in the same cloud storage.

  • Create an object of WordsApi while passing ClientID and ClientSecret as arguments
  • Upload Word file to Cloud storage using UploadFileRequest(..) method
  • Create an object of GetDocumentWithFormatRequest which takes Word file name and TIFF as desired output format
  • Call the get_document_with_format(..) method to perform the conversion operation

Convert Local DOC to TIFF using Python

In this section, we are going to discuss the details on how to load a Word document from a local drive and perform the conversion to TIFF format. The resultant output is stored in cloud storage.

  • Create an object of WordsApi while passing ClientID and ClientSecret as arguments
  • Read the content of a Word file from a local drive using the open(..) method
  • Create an object of ConvertDocumentRequest which takes the loaded Word file name, resultant format, and output file pathname as arguments
  • Finally, call the convert_document(..) method to perform the conversion operation

DOC to TIFF Conversion using cURL Command

Now we are going to learn the steps on how to perform the DOC to TIFF conversion using cURL Commands over the command line terminal. As shared earlier, the APIs are only accessible to authorized persons, so we need to first generate a JWT access token based on our client credentials. Please execute the following command to generate the JWT Token.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bbf94a2c-6d7e-4020-b4d2-b9809741374e&client_secret=1c9379bb7d701c26cc87e741a29987bb" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Once the token has been generated, we need to execute the following command to convert DOC to TIFF format. The outPath parameter specifies the location for resultant TIFF in cloud storage.

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

Conclusion

In this article, we have explored the details of converting Word to TIFF Document using Python SDK. We have learned how we can load a Word file from cloud storage and render the output to TIFF format or, we can load the Word document from a local drive and save the output in TIFF format. Furthermore, we have also seen the steps to convert Word to TIFF using the cURL command.

You may also consider exploring the Programmers Guide to further learn about the exciting features being offered by the API. At the same time, you may also download the complete source code of SDK from GitHub and customize it as per your requirements (it’s published under an MIT license).

We recommend visiting the following articles to learn about: