• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Batch extract pages from pdfs

Page history last edited by Monica 8 years, 4 months ago

 


 

Use Case

Use when wish to extract a particular page or range of pages across multiple PDF files. For example to repurpose text such as found on Title pages, Table of Contents or Abstracts for metadata purposes.

 

Software

  • Adobe Acrobat (using Acrobat JavaScript)

  • DOS Command (optional) for renaming files or batch moving files

 

 

General notes

Cut-and-paste below scripts into Acrobat Console Window (Actions)

NB: page numbers in JavaScript are zero-based, i.e., page zero in JavaScript is page one in the Acrobat viewer.

 

To setup script:

  • In Acrobat, search tools for “Action Wizard”

  • Select New Action

  • Use default settings (Files to be process = prompt for file locations)

  • Add “Execute JavaScript” (found under More Tools from left hand menu ) – SEE figure A

  • Click on “Specify settings” – SEE figure B

  • Copy and paste code

  • Click Save and enter name for action (e.g. Extract 1st page of PDFs)

To launch script

  • Select action from “Action List”

  • Adjust script for different page(s), select “manage actions”

  • TIP: Review report when complete – SEE figure C

 

 

Code examples

/* script to extract 1st page of PDF */

var filename = this.path;this.extractPages({nStart:0, cPath:filename+"_first_page.pdf"});

 

/* script to extract page range in PDFs */

var filename = this.path;this.extractPages({nStart:8, nEnd:9, cPath:filename+"_abstract.pdf"});

 

Screenshots

FIGURE A

FIGURE B

 

FIGURE C

 

Resources

Thom Parker. 2009. “Extracting Pages from a PDF with Acrobat JavaScript.” Adobe Acrobat Users Community. https://acrobatusers.com/tutorials/extracting-pages-pdf-acrobat-javascript.

 

“Export Pages with Javascript in Adobe Acrobat X Pro - Stack Overflow.” 2013. http://stackoverflow.com/questions/11954064/export-pages-with-javascript-in-adobe-acrobat-x-pro.

 

“extractPages from JavaScript for Acrobat API Reference > JavaScript API > Doc > Doc Methods > extractPages.” Accessed 2015. http://help.adobe.com/livedocs/acrobat_sdk/10/Acrobat10_HTMLHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Acrobat10_SDK_HTMLHelp&file=JS_API_AcroJS.88.460.html.

 

 

 

Comments (0)

You don't have permission to comment on this page.