Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

PdfDocumentProcessor.DeletePage(Int32) Method

Deletes the specified page from the current document.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v19.1.dll

Declaration

public void DeletePage(
    int pageNumber
)

Parameters

Name Type Description
pageNumber Int32

An integer value, specifying the page number.

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");
            }
        }
    }

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