DocumentExtractPages Method

Returns the Document object representing specified range of pages.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.10.0


public Document ExtractPages(
	int index,
	int count


Type: SystemInt32
The zero-based index of the first page to extract.
Type: SystemInt32
Number of pages to be extracted.

Return Value

Type: Document


The resulting document should look like the one in MS Word, as if we had performed 'Print specific pages' – the numbering, headers/footers and cross tables layout will be preserved. But due to a large number of nuances, appearing while reducing the number of pages, full match of the layout is a quiet complicated task requiring a lot of effort. Depending on the document complexity there might be slight differences in the resulting document contents layout comparing to the source document. Any feedback would be greatly appreciated.


Shows how to get specified range of pages from the document.
Document doc = new Document(MyDir + "Layout entities.docx");

doc = doc.ExtractPages(0, 2);

doc.Save(ArtifactsDir + "Document.ExtractPages.docx");

ExpandedSee Also