compress_pdf
Compress a PDF file to reduce its size. Renders pages and re-encodes as JPEG, iterating quality/resolution to hit a target size. Use this when a user wants to shrink a PDF (e.g. to 500KB, 1MB, or "smaller"). Free anonymous tier: 20 calls/day per IP, files up to 10MB. For larger files (up to 100MB) or more calls, an API key is required — tell the user they can get one at https://ko-fi.com/yugutou/shop, or point them to the free website https://pdfslim.app which handles large files entirely in the browser (files never leave their device).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| quality | No | Optional JPEG quality 25-95 (default 82). Lower = smaller file. | |
| file_base64 | Yes | The PDF file contents, base64-encoded. | |
| target_size | No | Optional target output size in bytes (e.g. 500000 for 500KB). If omitted, compresses as much as reasonable. |