Free plan

Compress Office file

Make a Word, Excel or PowerPoint file smaller
POST
/v1/documents/compress

About this tool

This tool makes an Office file smaller so it is easier to send by e-mail. It mainly shrinks the pictures inside it, removes the small preview image and stored printer settings, and packs the file tighter. Lower picture quality means a smaller file but slightly less sharp pictures. The text is not changed.
For example, a PowerPoint with many photos is too big to e-mail, so you shrink it first.

How to use it

  1. Choose this tool.
  2. Add your Word, Excel, PowerPoint or OpenDocument file with Upload or drag and drop.
  3. Set the picture quality and the largest picture size, or keep the defaults.
  4. Press Generate.
  5. Download the smaller file.

What you get back

You get a new, smaller file of the same type to download. Your original file stays as it was.
GOOD TO KNOW
A picture is only replaced when the new one is smaller; its name and format stay, so every reference keeps working. Only JPEG and PNG pictures are touched. Files with macros are refused. Counts as one document.
TEST IT LIVE

Try Compress Office file in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Documents
Plan
Free
Method
POST
Endpoint
/v1/documents/compress
Tool ID
documents.compress
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Documents
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/documents/compress" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'image_quality=75' \
  -F 'max_dimension=2000' \
  -F 'min_image_bytes=10000'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.compress({
    "file": 'document.pdf',
    "image_quality": 75,
    "max_dimension": 2000,
    "min_image_bytes": 10000
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->compress([
    'file' => 'document.pdf',
    'image_quality' => 75,
    'max_dimension' => 2000,
    'min_image_bytes' => 10000,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Make a Word, Excel, PowerPoint or OpenDocument file smaller: its pictures are re-encoded (JPEG quality, an upper size, PNG recompressed or reduced to a palette), thumbnails and printer settings are dropped and every part is stored with the strongest ZIP compression.

Compress Office file works from text and settings, so no file is needed. Every input is optional.

Compress Office file is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/documents/compress with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.