PDF Editing Issues

Delete PDF Pages by Text Search in Adobe Acrobat

Nimra MalikNimra Malik Nov 24, 2026 868 views

Question details

Find pages containing names from a list and automatically delete those pages from a large PDF.

Delete PDF Pages by Text Search in Adobe Acrobat
Product
Adobe Acrobat Pro
Device & OS
not provided
Scenario
A PDF contains pages for different classes, and pages matching specified names need to be removed.
Observed behavior
The desired result is a PDF that retains only pages without the specified names.
Before you start

Check that the PDF text is searchable; run OCR on scanned pages if necessary. Review or remove any existing redaction marks, because the script also treats those pages as matches.

Solution 1Recommended

Use Acrobat Action Wizard to delete pages marked by a name search

Create an action that marks matching names for redaction, then deletes the marked pages with JavaScript.

The script collects pages containing redaction annotations, removes duplicate page numbers, and deletes pages from last to first so earlier page indexes remain unchanged. It stops without deleting anything if every page is marked.

This method deletes entire pages, not just the matching names. Acrobat must allow page deletion for the PDF, and Action Wizard and JavaScript availability can depend on the Acrobat version and permissions.

1
Create an action

In Acrobat Pro, open Action Wizard and select New Action. The tool location may vary by Acrobat version.

2
Add the name search

Under Protection, add Search and Remove Text. Configure the search for multiple words or phrases, enter the names, and mark all matching results for redaction. Do not apply the redactions before the JavaScript step.

3
Add the script

Under More Tools, add Execute JavaScript and open its script editor. Paste: var annots = this.getAnnots() || []; var pages = []; var seen = {}; for (var i = 0; i < annots.length; i++) { if (annots[i].type === 'Redact' && !seen[annots[i].page]) { seen[annots[i].page] = true; pages.push(annots[i].page); } } if (pages.length >= this.numPages) { app.alert('All pages are marked. No pages were deleted.'); } else { pages.sort(function(a, b) { return b - a; }); for (var j = 0; j < pages.length; j++) { this.deletePages({nStart: pages[j], nEnd: pages[j]}); } }

4
Run and review

Save the action, select the PDF in Action Wizard, and run it. Review the search marks before continuing to the script, then inspect the remaining pages and save the result.

Use Acrobat Action Wizard to delete pages marked by a name search
Check all redaction marks: Any existing redaction annotation can cause its page to be deleted, even if it was not created by the name search. If no matches are marked, the script deletes no pages.
Free Microsoft Office alternative

Review and edit PDF files with WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with documents and PDFs. It makes migration easier through support for common Office formats, although it does not run Acrobat Action Wizard scripts.

Open and review PDF pages in an easy-to-use workspaceCompatible with Microsoft Office formats including DOCX, XLSX, and PPTXWork with familiar document tools in a lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why are the pages deleted in reverse order?

Deleting a page changes the indexes of later pages. Sorting the marked page numbers from highest to lowest prevents those shifts from changing the remaining selections.

Can this find names in a scanned PDF?

Only if the names are searchable. In Acrobat, run the Scan & OCR text-recognition tool first, then check that a name can be found with Search.

What happens if a page contains more than one matching name?

The script records each marked page only once, so a page with multiple redaction annotations is deleted once.

Can I extract the matching pages into one PDF instead?

The deletion script does not create an extracted PDF. Simply replacing deletePages with extractPages in the loop can create separate files; combining matches into one file requires a different workflow or script.