docs: add targetSize parameter to image-to-pdf API docs

This commit is contained in:
SnapOtter
2026-04-27 22:39:57 +08:00
parent 490da4d14a
commit e6cb3ef91d
2 changed files with 18 additions and 1 deletions
+17
View File
@@ -2397,6 +2397,10 @@ paths:
- `pageSize` (string, default "A4") — One of: A4, Letter, A3, A5
- `orientation` (string, default "portrait") — One of: portrait, landscape
- `margin` (number 0-500, default 20) — Page margin in points
- `targetSize` (object, optional) — Target output file size
- `value` (number, required) — Positive number (decimals allowed)
- `unit` (string, required) — One of: KB, MB
Minimum effective target is 50KB. When set, images are compressed as JPEG with quality auto-tuned to meet the target.
responses:
"200":
description: Generated PDF (downloadUrl points to .pdf file)
@@ -2410,6 +2414,19 @@ paths:
pages:
type: integer
description: Number of images/pages in the PDF
compression:
type: object
description: Present only when targetSize was specified
properties:
targetRequested:
type: integer
description: Target size in bytes
targetMet:
type: boolean
description: Whether the target was achieved
jpegQuality:
type: integer
description: Final JPEG quality used (10-95)
"400":
description: Invalid input
content:
+1 -1
View File
@@ -121,7 +121,7 @@ curl -X POST http://localhost:1349/api/v1/tools/<toolId>/batch \
| `strip-metadata` | Strip Metadata | - |
| `edit-metadata` | Edit Metadata | `title`, `description`, `author`, `copyright`, `keywords`, `gps` (lat/lon), `dateTime` |
| `bulk-rename` | Bulk Rename | `pattern` (supports `{n}`, `{date}`, `{original}`), `startIndex`, `padding` |
| `image-to-pdf` | Image to PDF | `pageSize` (A4/Letter/), `orientation`, `margin`, `fitMode` |
| `image-to-pdf` | Image to PDF | `pageSize` (A4/Letter/...), `orientation`, `margin`, `targetSize` ({value, unit}) |
| `favicon` | Favicon Generator | `padding`, `backgroundColor`, `borderRadius` - generates all standard sizes |
### Adjustments