These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Extracting a series of pages

techwriter
Registered: Dec 19 2007
Posts: 20
Answered

I need to extract a series of pages and save each file with a specific name and in a specific folder. For example, pages 2-6 would be in a pdf named "new york city" and go in a folder named "city." Pages 8-23 would be named "Atlanta" and go in the same "city" folder. I will have to do this for multiple documents, so I want to automate the process. I'm working in acrobat 6 pro.

Since "extract pages" only allows me to extract one set of pages at a time, how would I go about writing a javascript to extract, name, and move a series of pdf files into the proper folder? I read about extractpages() in the adobe javascript manual, but didn't understand how I could apply it to my situation. Any help would be appreciated.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The "doc.extractPages()" function has 3 parameters, start Page, end page, and the path of the file for saving the extracted pages. This is exactly what you described as your requirements. So it's a matter of applying it to your specific situation.

Is this a one time thing? Or a repetitive task? Is it always the same pages? Or do the page numbers change? Are you a programmer?

If this is a one time task, the the script can be run from the console window, and it is only a few lines.

Read these articals:

http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/javascript_console/

http://www.acrobatusers.com/tutorials/2007/js_file_paths/

Here's the code:
  this.extractPages(1,5,"city/Atlanta.pdf");this.extractPages(7,22,"city/NewYorkCity.pdf");

If this is a repetitive task then you need an Automation Script, and especially if the page numbers and file names change. If you are not a programmer then you need to hire one, because this is not a one liner.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

techwriter
Registered: Dec 19 2007
Posts: 20
Thanks for the help. This isn't a one time task, but it also isn't something that needs to be done every day. The pagination will change as the document is revised, but the file names will be the same. I figured I could just change the page numbers in the script before running it again. I'm not a programmer, so I don't want to get too complicated.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Then you have your answer. Use the code provided in my last post as a template. Place it into a text file. when you need to use it, copy and paste into the console window and run it from there.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script