PDF compress
Try it interactively →POST /api/pdf-compressShrink a PDF by re-compressing embedded images. Configurable image quality (1–100). Lossless for vector / text content; lossy only for raster images at the requested quality.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| pdf* | file | — | The PDF to compress. |
| dropMetadata | boolean | false | Strip /Info, /Metadata, and XMP packets. |
Response
Modes: binary, base64-json. Cache: yes (24h TTL).
Code samples
Built from the default-compress example.
# Download or substitute the example input:
# curl -O https://xtract.bot/examples/pdf-extract-text/hello.pdf
PDF=$(base64 -w0 < hello.pdf)
curl -X POST https://api.xtract.bot/api/pdf-compress \
-H "Content-Type: application/json" \
-H "Accept: application/octet-stream" \
-H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
-H "X-Api-Key: $XTRACT_API_KEY" \
-d '{
"dropMetadata": false,
"pdf": "'"$PDF"'"
}'