Skip to main content
aneegee
Participant
December 1, 2023
Question

Extracting pages in pdf file

  • December 1, 2023
  • 2 replies
  • 781 views

I have a 693 page pdf file and need to extract every 3rd page.  Does anyone know how to accomplish this?

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
December 6, 2023

Do you mean pages 1, 4, 7, etc.?

What should be the names of the files when these pages are extracted?

aneegee
aneegeeAuthor
Participant
December 6, 2023

Pages would be 3, 6, 9, 12 etc.  Then extracted into one file.

try67
Community Expert
Community Expert
December 6, 2023

As mentioned, it would be easier to do it by deleting all the other pages, and then saving the file under a new name. You can do that using this code:

 

for (var i=this.numPages-1; i>=0; i--) {
	if (((i+1)%3)!=0) this.deletePages(i,i);
}
this.saveAs(this.path.replace(this.documentFileName, "ExtractedPages.pdf"));

 

You can run it from the JS Console, for example.

Bernd Alheit
Community Expert
Community Expert
December 6, 2023

Extract as separate files?

aneegee
aneegeeAuthor
Participant
December 6, 2023

Pages would be 3, 6, 9, 12 etc.  Then extracted into one file.

Bernd Alheit
Community Expert
Community Expert
December 6, 2023

Delete the unwanted pages and save the file with a new name.