How to Search a PDF for Multiple Terms and Extract Matching Pages
Question details
The user needs to search a large PDF file for three distinct terms and extract only the pages containing all three terms into a separate PDF file.

- Product
- PDF Editors
- Device & OS
- not provided
- Scenario
- Filtering a large PDF document to locate highly specific information that requires multiple keyword matches on a single page, then isolating those results.
- Observed behavior
- Basic PDF search functions cannot filter pages based on the simultaneous presence of multiple different terms, nor can they directly export the matching pages in a single automated workflow.
Ensure you have a professional PDF editor with advanced scripting capabilities installed, such as Adobe Acrobat Pro, as standard PDF readers do not support conditional multi-term searches and automated page extraction natively.
Create a Custom JavaScript Search in Adobe Acrobat Pro
Use Acrobat Pro's built-in JavaScript console to automate the process of searching for multiple terms and extracting the matching pages.
Standard search features in Acrobat do not allow simultaneous multi-term matching per page combined with automatic extraction. A custom JavaScript is required to iterate through each page, check for the presence of all terms, and extract those specific pages into a new file.
Launch Adobe Acrobat Pro and open the large PDF document you want to search through.
Press Ctrl+J (on Windows) or Cmd+J (on Mac) to open the JavaScript Debugger console.
Enter a custom JavaScript routine that loops through the document using the 'getPageNumWords' and 'getPageNthWord' methods, checks if all three terms exist on the current page, and uses the 'extractPages' method to pull those matching pages.
Once the script finishes running, a new PDF tab containing only the pages with all three terms will be generated. Save this new document to your local drive.

Utilize a Python Script with PDF Libraries
If writing JavaScript in Acrobat Pro is not feasible, a Python script using external PDF libraries can efficiently search and extract the pages.
Handle Everyday PDF and Office Tasks with WPS Office
While complex automated PDF page extraction requires custom scripting, WPS Office provides a highly capable, user-friendly PDF editor alongside powerful Word, Excel, and PowerPoint alternatives. It is lightweight, free to download, and simplifies standard document management.

Frequently Asked Questions
Can I use the basic 'Ctrl+F' search to find multiple terms on the same page?
No, standard PDF readers using the basic 'Ctrl+F' (Find) function only allow you to search for a single exact word or phrase at a time. They cannot perform conditional 'AND' searches across a single page.
Does Adobe Acrobat's Advanced Search feature allow page extraction?
Acrobat's Advanced Search (Shift+Ctrl+F) can search multiple PDFs and use boolean operators like 'AND', but it lists the occurrences in a sidebar. It does not automatically isolate and export the specific pages containing the terms into a new file.
Is there a way to extract pages manually after finding them?
Yes. If the document isn't excessively large, you can use the Advanced Search to find where the terms overlap, manually note the page numbers, and then use the 'Organize Pages' or 'Extract' tool in your PDF editor to pull those specific pages into a new document.
Does case sensitivity matter when searching PDFs via scripts?
Yes, if you are using JavaScript or Python to search text, you must explicitly code whether the search should be case-sensitive. By default, many basic scripts differentiate between 'Term' and 'term' unless you program them to convert all text to lowercase before matching.




