Free plan

Compress PDF

Make a PDF smaller so it is easy to send or upload
POST
/v1/pdfs/optimize

About this tool

This tool reduces the file size of a PDF, mostly by shrinking its pictures, and can also repair a damaged PDF. You choose a method. One lowers picture quality or resolution, for example for screen reading or for printing, and can turn colours to grey. Another can aim for a target size. Text is never made worse.
For example, your 40 MB scanned report is too big for e-mail, so you shrink it to a few MB.

How to use it

  1. Choose this tool.
  2. Add your PDF.
  3. Choose how to shrink it: for example, a ready-made level such as screen or ebook, or a size you would like to reach.
  4. Set optional choices such as picture quality, grey colours, or repairing a broken file.
  5. Press Generate, then download the smaller PDF.

What you get back

You get a new, usually smaller PDF, and you can download it. If the file is already well compressed, it may not shrink much.
GOOD TO KNOW
recompressImages combined with engine=qpdf -> 400 invalid_parameter.
TEST IT LIVE

Try Compress PDF 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
PDFs
Plan
Free
Method
POST
Endpoint
/v1/pdfs/optimize
Tool ID
pdfs.optimize
Authentication
API key
Accepts
PDF
Background jobs
Yes
Usage group
Pdf
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/pdfs/optimize" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'imageQuality=75' \
  -F 'imageColorSpace=srgb' \
  -F 'profile=screen'

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.pdfs.optimize({
    "file": 'document.pdf',
    "imageQuality": 75,
    "imageColorSpace": "srgb",
    "profile": "screen"
  });
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->pdfs()->optimize([
    'file' => 'document.pdf',
    'imageQuality' => 75,
    'imageColorSpace' => 'srgb',
    'profile' => 'screen',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Make a PDF smaller so it is easy to send or upload.

Compress PDF accepts PDF. You can send several files in one request.

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

Send a POST request to /v1/pdfs/optimize 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.