x
Skip to main content

Compress PDF

Tool ID: compress-pdf

Reduce PDF file size by compressing images, optimizing structure, and removing unnecessary data.

Important: Compression is permanent. Always keep a backup of the original if you might need maximum quality later.


How to Use

  1. Upload Your PDF - Select one or more PDFs
  2. Choose Compression Level - Select quality vs. size balance
  3. Configure Options - Enable grayscale, line art, etc. (optional)
  4. Compress - Process the files
  5. Download - Get your compressed PDFs

Options

OptionDescription
Optimize Level (1-9)Controls compression aggressiveness. Higher = smaller file, lower quality. Levels 1-3 are light, 4-5 are moderate, 6+ trigger additional compression passes
Expected Output SizeSet a target file size (e.g. 25MB) and the tool will automatically adjust the optimize level to hit it
GrayscaleConvert all images to grayscale. Can significantly reduce size for color documents where color isn't needed
LinearizeOptimize PDF for fast web viewing - reorders the file so the first page loads before the entire file is downloaded
NormalizeNormalize internal PDF structure for better compatibility
Line ArtConvert images to high-contrast line art. Useful for documents with diagrams, sketches, or black-and-white illustrations
Line Art Threshold (0-100)Controls sensitivity of line art conversion. Default: 55. Only used when Line Art is enabled
Line Art Edge Level (1-3)Edge detection strength for line art. 1 = light, 3 = strong. Only used when Line Art is enabled

What Happens at Each Level

  • Levels 1-3 - Basic optimization, preserves quality
  • Levels 4-5 - Image recompression enabled, moderate quality reduction
  • Levels 6+ - Aggressive compression with additional processing passes
  • Levels 8+ - Uses Zopfli compression on supported systems for maximum reduction

API Usage

curl -X POST http://stirling-pdf:8080/api/v1/misc/compress-pdf \
-F "[email protected]" \
-F "optimizeLevel=5" \
-F "grayscale=false" \
-F "linearize=false" \
-F "lineArt=false" \
-o compressed.pdf

With target size:

curl -X POST http://stirling-pdf:8080/api/v1/misc/compress-pdf \
-F "[email protected]" \
-F "expectedOutputSize=10MB" \
-o compressed.pdf

See API Documentation for complete endpoint reference.


  • OCR - Make searchable before compressing
  • Convert - Convert formats before compressing
  • Merge - Combine then compress