Skip to main content
Participant
January 16, 2020
Question

Extract Pages from Multiple PDFs

  • January 16, 2020
  • 1 reply
  • 334 views

I have a set of over twenty PDFs, all with the same page layout but different content. I need to extract pages 7-8 from each PDF into a separate PDF, but not all in the same file. Thus:

  • PDF1 becomes pages.7-8_PDF1
  • PDF2 becomes pages.7-8_PDF2
  • PDF3 becomes pages.7-8_PDF3 etc.

I have tried using JavaScript, but cannot figure it out. Is there a way to accomplish this using JavaScript or Acrobat Actions without going through each file individually?

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
January 16, 2020

Yes there is. Use the "doc.extractPages()" function.

Here's the reference entry:

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_AcroJS%2FDoc_methods.htm%23TOC_extractPagesbc-33&rhtocid=_6_1_8_23_1_32

 

Here's a simple script for an Action.

 

this.extractPages(6,7,this.path.replace(/\/([^\/]+\.pdf$)/i,"/pages.7-8_$1"));

 

 

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