Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfDocumentProcessor.DeletePage(Int32) Method

Deletes the specified page from the document.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v24.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