Skip to content

Quickstart ​

Compress your first PDF with Hyper Compress. By the end of this page you will have a smaller PDF, know how to read the result, and know which way of running Hyper fits your project.

Every way of running Hyper uses the same engine, the same presets and the same options, so the same settings give the same file everywhere.

Before you begin ​

  • A PDF to try. Any file works; a scanned document or a report with photos shows the biggest savings.
  • For the terminal or Node.js: Node.js 22 or newer on macOS (Apple silicon), Linux (x64 or ARM64) or Windows (x64). Check with node --version.
  • For the HTTP service: Docker.
  • For the browser: nothing.

TIP

Just want a smaller file right now? Open hyper.bentopdf.com and drop your PDF on the page. It runs entirely in your browser; your file is never uploaded.

1. Install ​

bash
npm install -g hyper-compress
bash
npm install hyper-compress
bash
docker run -d --name hyper -p 8080:8080 \
  ghcr.io/alam00000/bentopdf-hyper-compress:latest
bash
npm install hyper-compress-wasm

The npm package installs the engine for your platform automatically, with no download scripts. The Docker image starts a private compression service with a web page and an HTTP API on port 8080.

2. Compress a PDF ​

bash
hyper input.pdf output.pdf
js
import { compress } from 'hyper-compress';

const result = await compress({
  sourcePath: 'input.pdf',
  savePath: 'output.pdf',
});

console.log(`${result.originalSize} -> ${result.compressedSize} bytes`);
bash
curl -o output.pdf --data-binary @input.pdf \
  'http://localhost:8080/api/compress'
js
import { readFile, writeFile } from 'node:fs/promises';
import { compress } from 'hyper-compress-wasm';

const input = new Uint8Array(await readFile('input.pdf'));
const result = await compress(input);

await writeFile('output.pdf', result.data);
console.log(`${result.originalSize} -> ${result.compressedSize} bytes`);

With no preset, Hyper uses medium: images at quality 50 and at most 150 dpi, fonts subset, duplicates merged. That suits documents you share and email.

From the CLI you see:

text
output.pdf
  2593056 -> 1250960 bytes (52% smaller)

The first line is where the result was written. The second is the input size, the output size and the saving. Leave out output.pdf and the CLI writes input-compressed.pdf beside the input.

3. Read the result ​

Hyper never fails silently and never makes a file bigger. Three things in the result tell you what happened:

What you seeWhat it means
Output size equals input sizeHyper could not make this file smaller, so it returned your original bytes. This is an outcome, not an error.
signed: true, or [signed: original preserved] in the CLIThe PDF has a digital signature. Hyper returned it untouched so the signature stays valid. See Signed documents.
A warning: line, or an entry in warningsHyper skipped something you asked for because it was unsafe for this file, and says why. See Warnings.

In Node.js all three are on the result object:

js
console.log(result.signed);    // true if the input was signed and returned untouched
console.log(result.warnings);  // [] when every requested option was applied

4. Choose a preset ​

Pick a preset by what the document is for:

PresetImagesUse it for
lowquality 80, up to 200 dpiarchiving and printing; minimal visible change
mediumquality 50, up to 150 dpithe default; sharing and email
highquality 20, up to 72 dpi; standard fonts left to the viewerthe smallest file, for reading on screen
losslessimages are not re-encodedfiles where every pixel must stay the same
bash
hyper input.pdf output.pdf --preset high
js
import { compress } from 'hyper-compress';

await compress({ sourcePath: 'input.pdf', savePath: 'output.pdf', preset: 'high' });
bash
curl -o output.pdf --data-binary @input.pdf \
  'http://localhost:8080/api/compress?preset=high'

A preset is a complete set of options. Override any of them on top of a preset; Choose the right settings shows how.

Which way should you run Hyper? ​

You want toUseRuns on
Compress files by hand or in shell scriptsCLImacOS (Apple silicon), Linux x64 and ARM64, Windows x64
Compress from a Node.js app or serverNode.js SDKsame as the CLI
Give other services or teams an APIHTTP API on Dockerany Docker host, x64 or ARM64
Compress in the browser, or where the native engine does not installWebAssemblyany browser, any Node.js 22+ platform
Embed Hyper in a Rust programRust cratethe native platforms above
Embed Hyper from C, C++ or another languageC APIprebuilt for macOS Apple silicon, builds elsewhere

Platforms and surfaces compares exactly what each one supports.

Next steps ​

Dual-licensed under AGPL-3.0 and Commercial License.