pdf_manipulate
Merge, split, rotate, reorder, delete, compress, encrypt, decrypt, and optimize PDF files. Modify PDF structure and properties to prepare documents for sharing or storage.
Instructions
Modify PDF structure and properties.
Merge, split, rotate, reorder, delete pages, compress, encrypt/decrypt, and optimize PDFs.
Return Format
A dict with keys:
success: bool - whether the operation succeeded
message: str - human-readable summary
operation-specific keys:
merge: {path, pages}
split: {files: [path, ...]}
rotate/reorder/delete_pages/encrypt/decrypt: {path}
compress: {path, original_size, compressed_size}
optimize: {path, original_size, optimized_size} On failure: {success: False, error, error_type}.
Examples
await pdf_manipulate(operation="merge", path="a.pdf", paths=["a.pdf", "b.pdf"]) {"success": true, "path": ".../merged_....pdf", "pages": 4, "message": "Merged 2 PDFs into merged_....pdf (4 pages)."}
await pdf_manipulate(operation="rotate", path="report.pdf", angle=90) {"success": true, "path": ".../report_rotate_....pdf", "message": "Rotated report.pdf by 90 degrees, saved to report_rotate_....pdf."}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the PDF file. Ignored for merge. | |
| angle | No | Rotation angle in degrees. Default 90. | |
| pages | No | Page range string (e.g. '1-5,7,9-12'). For rotate operation. | |
| paths | No | List of PDF paths to merge. Only for merge operation. | |
| ranges | No | Split ranges as list of [start, end] pairs (1-indexed). | |
| quality | No | Compression quality 1-100. Default 85. | |
| password | No | Password for encrypt/decrypt operations. | |
| new_order | No | New page order (1-indexed list). For reorder operation. | |
| operation | Yes | ||
| page_list | No | List of page numbers to delete. For delete_pages operation. | |
| output_dir | No | Output directory for split operation. | |
| output_path | No | Output path. Auto-generated if omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | No | Human-readable summary | |
| success | No | Whether the operation succeeded |