# Extract pages Following this guide you will learn how to extract pages from PDF, Word, Excel, PowerPoint and many other file types using GroupDocs.Merger for .NET. **GroupDocs.Merger** allows to extract pages from source document. The result is a new document that contains only specified pages from the source document. {{< alert style="warning" >}} Specify at least one page number. Calling `ExtractPages` without page numbers (for example, with `new ExtractOptions()`) throws `GroupDocsMergerException` ("There are no page numbers to extract."). {{< /alert >}} Here are the steps to extract document pages: * Initialize [ExtractOptions](https://reference.groupdocs.com/merger/net/groupdocs.merger.domain.options/extractoptions) class with page numbers that should appear in the resultant document; * Instantiate [Merger](https://reference.groupdocs.com/merger/net/groupdocs.merger/merger) object with source document path or stream; * Call [ExtractPages](https://reference.groupdocs.com/merger/net/groupdocs.merger/merger/extractpages) method and pass [ExtractOptions](https://reference.groupdocs.com/merger/net/groupdocs.merger.domain.options/extractoptions) object to it; * Call [Save](https://reference.groupdocs.com/merger/net/groupdocs.merger/merger/save/#save_1) method specifying file path to save resultant document. The following code sample demonstrates how to extract document pages **by specifying exact page numbers**: ```csharp string filePath = @"c:\sample.pdf"; string filePathOut = @"c:\output\result.pdf"; ExtractOptions extractOptions = new ExtractOptions(new int[] { 1, 4 }); // Resultant document will contain pages 1 and 4 using (Merger merger = new Merger(filePath)) { merger.ExtractPages(extractOptions); merger.Save(filePathOut); } ``` The following code sample demonstrates how to extract document pages **by specifying page numbers range**: ```csharp string filePath = @"c:\sample.pdf"; string filePathOut = @"c:\output\result.pdf"; ExtractOptions extractOptions = new ExtractOptions(1, 3, RangeMode.EvenPages); // Resultant document will contain page 2 using (Merger merger = new Merger(filePath)) { merger.ExtractPages(extractOptions); merger.Save(filePathOut); } ```