Skip to main content

Organize PDF pages

Delete selected pages from a PDF copy

Remove selected PDF pages from a newly generated copy after explicit confirmation, while keeping the original browser-selected document unchanged.

Practical steps

Remove pages from a downloaded PDF copy

Choose the pages to exclude, confirm the permanent change to the output, and create a separate document.

  1. SelectChoose one PDF and enter a one-based page expression.
  2. ConfirmAcknowledge that the selected pages will not exist in the downloaded copy.
  3. CreateGenerate the new PDF and review the source and output page counts.

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.