I have several 1,000 pdf documents with varying numbers of pages. However, all documents contain a specific text that only appears once in the document, but on a different page in each document.
I would like to use a script to find the page with the specific text and then delete all pages after this page.
Total number of pages: 125
Specific text: "Document attachment"
Number of pages with specific text: 27
Delete pages 28 to 125
It would be great if someone could help me with a script that does this task.
Many thanks in advance
Copy link to clipboard
The best way to do that is in an Action. You can use the Search & Remove text command to locate the text and mark it for redaction. Then you use a script to locate those Redaction comments and delete the pages they are on. The latter has to be done from the last page backwards, though.