Extract pages
extract_pagesExtract selected pages into a new PDF in the order you specify, or reorder pages without changing the original. Use overwrite: true to replace an existing output.
Instructions
Writes the chosen pages of a PDF to a new PDF, in the order given ("3,1" puts page 3 first). Use it to pull out or reorder pages; to cut a whole document into equal parts, use split_pdf. The original is not changed, and an existing output file is only replaced with overwrite: true. Fails with a message for an invalid or out-of-range page and for encrypted PDFs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path of the PDF. | |
| pages | Yes | Pages to keep, in the order wanted, e.g. "3,1-2" (each page is written once; repeats are ignored). | |
| output | Yes | Absolute path of the new PDF. If the file exists, the call fails unless overwrite is true. | |
| 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). |