# Delete pages from a PDF: web app and CLI

## What it does
Removes the pages you specify from a PDF document and returns a new PDF without those pages.

## Inputs and limits
* Input file: a PDF up to 32 MB.
* Page numbers: one or more pages, entered as a list (e.g. `2,5-8`) or a range (e.g. `3-6`).  
  The numbers refer to the original document order, starting at 1.
* The tool works with unprotected PDFs. Encrypted or password‑protected files are not processed.

## Web app
The web page asks you to:
1. Upload a PDF file (maximum size 32 MB).
2. Type the page numbers to delete in the field “Enter the page numbers”.  
   Use commas or hyphens for ranges, for example `2,6-10`.
3. Click the **Delete** button.

After processing, a link appears to download the new PDF that contains all pages except the ones you removed.

## Command line (CLI)
The CLI plugin `Documentize.RemovePages` removes pages from a PDF placed in a task folder.  
You must provide the page range with the `--remove-range` flag and a task identifier so the plugin knows where to read the input and write the output.

```bash
# Linux / macOS (needs the .NET 10 runtime and documentize.lic next to the DLL)
export PLUGIN_INPUT_DIR=./work/input
export PLUGIN_OUTPUT_DIR=./work/output
mkdir -p "$PLUGIN_INPUT_DIR/job1"
cp sample.pdf "$PLUGIN_INPUT_DIR/job1/"
dotnet Documentize.RemovePages.dll --task-id job1 --remove-range 1
ls "$PLUGIN_OUTPUT_DIR/job1"
```

```powershell
# Windows PowerShell
$env:PLUGIN_INPUT_DIR  = "$PWD\work\input"
$env:PLUGIN_OUTPUT_DIR = "$PWD\work\output"
New-Item -ItemType Directory -Force "$env:PLUGIN_INPUT_DIR\job1" | Out-Null
Copy-Item sample.pdf "$env:PLUGIN_INPUT_DIR\job1\"
dotnet Documentize.RemovePages.dll --task-id job1 --remove-range 1
Get-ChildItem "$env:PLUGIN_OUTPUT_DIR\job1"
```

## Verified

Every code sample on this page was run on 2026-11-03 and its result was checked:

- Delete a page from PDF via CLI (CLI plugin): passed in 4 s
