.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

PdfDocumentProcessor.DeletePage(Int32) Method

Deletes the specified page from the current document.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v21.1.dll

Declaration

public void DeletePage(
    int pageNumber
)

Parameters

Name Type Description
pageNumber Int32

The page number(starting with 1).

Example

This example illustrates how to use the PDF Document API component for deleting pages from a document.

In this example, the PdfDocumentProcessor.DeletePage method is called 55 times to delete each odd numbered page in the TextDelete document (contains 109 pages), starting from the last odd numbered page.

The result is saved to the Deleted document, which contains only even pages, by calling the PdfDocumentProcessor.SaveDocument method.

using DevExpress.Pdf;
// ...
    class Program {
        static void Main(string[] args) {
            using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor()) {
                pdfDocumentProcessor.LoadDocument("..\\..\\docs\\TextDelete.pdf");
                for (int i = pdfDocumentProcessor.Document.Pages.Count / 2; i >= 0; i--)
                    pdfDocumentProcessor.DeletePage(i * 2 + 1);
                pdfDocumentProcessor.SaveDocument("..\\..\\docs\\Deleted.pdf");
            }
        }
    }
See Also