ZingPDF logo

Guide

How to delete PDF pages in C#

Call DeletePageAsync(pageNumber) with a 1-based page number, then save the updated document.

This is the direct path when you need to remove a cover page, a trailing appendix, or a known page from the middle of a document.

Delete the page and save

If you know which page needs to go, call the delete method and save the result.

using ZingPDF;

using var pdf = Pdf.Load(File.OpenRead("packet.pdf"));

await pdf.DeletePageAsync(2);
await pdf.SaveAsync(File.Create("page-deleted.pdf"));

Page numbers are 1-based

ZingPDF uses the same 1-based page numbering across the rest of the page API, so the first page is 1, not 0.

Later page numbers move down after a deletion

Once a page is removed, later pages shift down. If you delete page 2 from a 5-page PDF, the old page 3 becomes the new page 2.

Delete multiple pages from highest to lowest

If you need to remove more than one page, work from the highest page number down to the lowest so you do not accidentally target the wrong page after the first deletion.

Need insert and append as well?

The page-management guide covers all three page-editing paths together.

Open page guide Open docs