Table of Contents

Method RemoveRange

Namespace
BitMiracle.Docotic.Pdf
Assembly
BitMiracle.Docotic.Pdf.dll

RemoveRange(int, int)

Removes a range of pages from the document's page collection.

public void RemoveRange(int index, int count)

Parameters

index int

The zero-based starting index of the range of pages to remove.

count int

The number of pages to remove.

Remarks

The combination of index and count must not remove all pages from the document, because the document must contain at least one page after the operation. A PdfException is thrown when attempting to remove all pages.

Splitting PDF documents is one of the use cases for this method. See the Split PDF documents in C# and VB.NET article for other approaches to this use case.

Exceptions

ArgumentOutOfRangeException

Thrown when index is outside the bounds of the collection, when count is less than or equal to 0, or when index + count exceeds the number of pages in the document.