Skip to main content
.NET Framework 4.5.2+

PdfDocumentProcessor.DeletePage(Int32) Method

Deletes the specified page from the document.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v22.1.dll

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.

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