Table of Contents

Method RemoveAt

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

RemoveAt(int)

Removes the page at the specified index from the document's page collection.

public void RemoveAt(int index)

Parameters

index int

The zero-based index of the page to remove.

Remarks

The last page of the document cannot be removed. A document must contain at least one page. A PdfException is thrown when attempting to remove the last page.

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.

PdfException

Thrown when the document contains only one page.

RemoveAt(int[])

Removes the pages at the specified indexes from the document's page collection.

public void RemoveAt(int[] indexes)

Parameters

indexes int[]

The zero-based indexes of the pages to remove.

Remarks

The operation must not remove all pages from the document. A document must contain at least one page after the removal. A PdfException is thrown when the specified indexes would remove every page.

The indexes array may contain indexes in any order.

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

ArgumentNullException

Thrown when indexes is null.

ArgumentException

Thrown when indexes is empty.

ArgumentOutOfRangeException

Thrown when any index in indexes is outside the bounds of the collection.

PdfException

Thrown when the removal would leave the document without any pages.