Deletion is an output transformation, not an in-place edit. The browser requires confirmation because the selected pages are permanently absent from the downloaded artifact, even though the source remains untouched.
Delete pages from .NET
using OfficeIMO.Pdf;
PdfDocument source = PdfDocument.Open("packet.pdf");
PdfPageSelector pagesToRemove = PdfPageSelector.Parse("2,4-6");
PdfDocument result = source.Pages.Delete(pagesToRemove);
File.WriteAllBytes("packet.cleaned.pdf", result.ToBytes());
Validate the output page count and required content before replacing or archiving any original outside OfficeIMO. Application code owns storage and overwrite policy; the PDF API returns a new document model.
When extraction is clearer
If the business rule identifies pages to keep, use extract pages instead. Expressing the positive selection often makes retention and disclosure workflows easier to review than maintaining a growing exclusion list.