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

How to delete all pages after the 2nd page?

Explorer ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

Good evening, I am trying t create an action that will delete all the pages after the 2nd page of the document, then save the file to a different folder.

I have tried using the "Delete pages" action, and that didn't work. but saving the file to another folder works just fine.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

148

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

correct answers 1 Correct answer

Community Expert , Dec 19, 2018 Dec 19, 2018

Add a command to run this JavaScript code, and then save the file:

this.deletePages(2, this.numPages-1);

Likes

Translate

Translate
Community Expert ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

Add a command to run this JavaScript code, and then save the file:

this.deletePages(2, this.numPages-1);

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 ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

LATEST

You'll need to use JavaScript for this. Just one line.

this.deletePages(2,this.numPages-1);

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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