Compress PDF
Optimize → Compress PDF
The Compress PDF API reduces PDF file size using an optimization profile. You send the PDF as Base64 (docContent), docName, optimizeProfile (Web, Print, or Screen), and optionally async. The API returns a compressed PDF. Use the tester below to try it; more details are in the sections that follow.
Try the Compress PDF API
Endpoint: POST /api/v2/Optimize · Required: api-key, docContent, docName, optimizeProfile
Use the form below to send your API key, PDF (Base64), and optimization profile (Web, Print, or Screen). The response is the compressed PDF. No code required—fill the fields and click Send request.
Overview, parameters, and use cases
- Overview
- Parameters
- Use cases
What is Compress PDF?
This endpoint compresses and optimizes a PDF to reduce file size. You choose optimizeProfile: Web (web viewing and fast download), Print (high-quality printing), or Screen (screen viewing). The API returns a compressed PDF while maintaining acceptable quality for the selected profile.
Optimization profiles
- Web – Optimized for web viewing and fast download.
- Print – Optimized for high-quality printing.
- Screen – Optimized for screen viewing.
Use when you need smaller PDFs for email, web, or storage. Combine with Merge Multiple PDF Files or Split PDF in a pipeline.
API parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| api-key | string | Yes | Your PDF4me API key, Base64 encoded. Get it from the dashboard. |
| docContent | base64 | Yes | PDF file content (Base64). |
| docName | string | Yes | Output PDF file name (e.g. output.pdf). |
| optimizeProfile | string | Yes | Web, Print, or Screen. |
| async | boolean | No | Enable asynchronous processing. |
When to use Compress PDF
- Web and email – Reduce file size for faster download or email.
- Storage – Compress PDFs for archiving or storage limits.
- Print vs screen – Choose Print for quality, Screen or Web for smaller size.
For request/response schemas and code samples, see Compress PDF in the PDF4me API docs.
Prerequisites
Before using this endpoint, make sure you have:
- A valid PDF4me API key (Get your API Key)
- A PDF file in Base64 format
Response Format
The API returns a compressed PDF file with reduced file size based on the selected optimization profile.