Skip to main content
Ryan_Oliver_02445
Known Participant
December 19, 2018
Answered

How to delete all pages after the 2nd page?

  • December 19, 2018
  • 2 replies
  • 640 views

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.

This topic has been closed for replies.
Correct answer try67

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

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

2 replies

Thom Parker
Community Expert
Community Expert
December 19, 2018

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

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

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 19, 2018

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

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