Compress a PDF
compress_pdfShrink a PDF by redrawing pages as JPEGs at a chosen quality; returns before/after sizes. Use for scans and photos; text-heavy files can grow.
Instructions
Makes a PDF smaller by redrawing every page as a JPEG image at the chosen quality, and returns the size before and after. Best for scans and photo-heavy files; for documents that are mostly text it usually makes the file larger, which the result then says. The text is no longer selectable afterwards: run recognize_text on the result to make it searchable again. To get separate image files instead, use pdf_to_images. The original is not changed, and an existing output file is only replaced with overwrite: true. Encrypted PDFs cannot be compressed.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>",
"output": "<output>"
},
"name": "compress_pdf"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path of the PDF. | |
| output | Yes | Absolute path of the new PDF. If the file exists, the call fails unless overwrite is true. | |
| quality | No | low: 96 dpi, smallest; medium: 144 dpi (default); high: 200 dpi. | |
| password | No | Password, if the PDF is encrypted. Without it an encrypted PDF cannot be opened; with it, it can be read, but tools that write a new PDF cannot save it. | |
| overwrite | No | Allow replacing an existing file (default false). |