• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Deleting all pages in a pdf file after a page with a specific text

New Here ,
Jul 27, 2022 Jul 27, 2022

Copy link to clipboard

Copied

Hello, I am a complete beginner with javascript and need help with creating a script in Acrobat DC. Maybe someone can help me 🙂

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.

 

Example:
Total number of pages: 125
Specific text: "Document attachment"
Number of pages with specific text: 27

 

Task:
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

TOPICS
Acrobat SDK and JavaScript , Windows

Views

45

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 27, 2022 Jul 27, 2022

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines