Skip to main content

PdfDocumentProcessor.DeletePage(Int32) Method

Deletes the specified page from the document.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v23.2.dll

NuGet Package: DevExpress.Document.Processor

Declaration

public void DeletePage(
    int pageNumber
)

Parameters

Name Type Description
pageNumber Int32

The page number (starting with 1).

Example

The code sample below deletes odd-numbered pages in a document, starting with the last odd-numbered page.

View Example: Delete Pages from PDF

using DevExpress.Pdf;

using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
  pdfDocumentProcessor.LoadDocument("..\\..\\docs\\TextDelete.pdf");
  for (int i = pdfDocumentProcessor.Document.Pages.Count; i > 0; i--)
    if (i % 2 != 0)
    {
      pdfDocumentProcessor.DeletePage(i);
    }

  pdfDocumentProcessor.SaveDocument("..\\..\\docs\\Deleted.pdf");
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DeletePage(Int32) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also