# Extract selected pages from a PDF

Extract ranges such as 1-3,5,last into a new PDF, preserve the selected order, and leave the original document unchanged in the browser or .NET.

Organize PDF pages

[Extract PDF pages in the browser](/browser/extract-pages/) [Read the .NET guide](/docs/pdf/operations/)

Extraction summary

**Input**

PDF and page selection

**Output**

Extracted PDF

**Package**

[OfficeIMO.Pdf on NuGet](https://www.nuget.org/packages/OfficeIMO.Pdf)

**Runs on**

Browser-local WebAssembly or .NET

**Microsoft Office**

Not required

**License**

MIT

Page expressions are one-based and resolved against a PDF of at most 500 parsed pages in the browser.

[Browse all PDF workflows](/pdf/)

Practical steps

## Extract a page range into a new PDF

Resolve a one-based page expression and write only the selected pages to a separate document.

1. **Select**Choose one PDF and review its page count.
2. **Describe**Enter a one-based expression such as 1-3,5,last.
3. **Extract**Create and download the new PDF plus its operation report.

Use extraction when the output should contain only a specific subset of pages. The selector supports individual pages, ranges, comma-separated combinations, and `last`, which is resolved against the current source.

## Extract from .NET

```csharp
using OfficeIMO.Pdf;

PdfDocument source = PdfDocument.Load("case-file.pdf");
PdfPageSelector selection = PdfPageSelector.Parse("1-3,5,last");
PdfDocument extracted = source.Pages.Extract(selection);

File.WriteAllBytes("case-file.extract.pdf", extracted.ToBytes());
```

The result is a new PDF. Page numbers in the output are compacted to the new document order, while the source file remains unchanged.

## Choose the right page operation

Extraction keeps the selected subset. [Delete pages](/pdf/delete-pages/) does the inverse and keeps everything except the selection. [Reorder pages](/pdf/reorder-pages/) creates a document using the supplied sequence. Keeping these operations separate makes automated policy and user confirmation much clearer.

## API used on this page

- [`PdfDocument`](/api/pdf/officeimo-pdf-pdfdocument/)

<!-- PowerForge markdown artifact sha256:9382D0D02A5E28EC04AEA46805F5461A0D6545E516826427D2D1E46BEFA5D8AF -->
