Compress Word File with NET REST API

This article describes how to compress Word file with NET REST API. You will learn to compress a picture in Word with C# Low Code API using the .NET cloud SDK. It has various options to customize the compression process and generate the output file according to the requirements.


Steps to Compress a Word DOC with C# Low Code API

  1. Create an object of the WordsApi class with the client ID and the secret to compress a file
  2. Create the CompressDocumentOnlineRequest object and set the CompressOptions, source document and output file
  3. Invoke the CompressDocumentOnline method to compress the pictures in the Word file
  4. Download the compressed output file

The above steps describe how to compress a Word document online with C# REST API. Load the source Word file having images in it and create a CompressDocumentOnlineRequest object by providing the input and output files along with the compression options. Call the CompressDocumentOnline method to compress the Word file and save the output Word file from the API response object.

Code to Compress Word Document with C# REST API

This code demonstrates the process to reduce the size of a Word file with C# Low Code API. The CompressOptions contains the options to set the image quality and factor to reduce the image size. You can also set the load encoding and the password using the CompressDocumentOnlineRequest object.

In this topic, we have learned to compress the Word file size by reducing the image size in a Word file. If you want to change the properties of a Word file, refer to the following article: Change Properties of Word Document with NET REST API.