Convert Word Page to Image with Python REST API

This article provides a guide on how to convert Word page to image with Python REST API. It will teach you to automatically transform a Word page to JPG with Python REST API using the Python cloud SDK. No other third-party Word file processor or image-processing software is required to perform this task.

Prerequisite

Steps to Convert Word Page to Image with Python REST API

  1. Initialize the WordsApi class object with client ID and client secret for rendering a page
  2. Create an object of the RenderPageOnlineRequest class
  3. Read the source Word file into the request object
  4. Set the page index and output image format
  5. Call the RenderPageOnline() method to render the desired page
  6. Save the output image from the response object

The above steps have summarized how to convert Word page into image with Python REST API. You need to instantiate the objects of WordsApi and RenderPageOnlineRequest classes by setting the desired values. Finally, call the RenderPageOnline() method to save the target page as an image in the desired format.

Code to Convert Word Page to JPG with Python REST API

This sample code exhibits how to convert Word page to image with Python REST API. You may set the desired page index starting from 1 instead of 0. The response object is a stream that you may save on the disk.

This article has guided us on how to make a Word DOC a picture with Python REST API. If you want to convert the complete Word file to an image, refer to the following article: Convert DOCX to JPG with Python REST API.

 English