Free Script Splits Long InDesign Files into Smaller Ones

Sandee Cohen alerted me and a few other lucky souls this morning to a useful, free script called ExtractPages she recently came across.

The script provides two features that InDesign’s Move Pages command (Layout > Pages > Move Pages) lacks: First, it can quickly spit out  a series of single-page INDD files from the page range you enter, just like the Extract Pages command in Adobe Acrobat. Just turn on the appropriate checkbox in the script’s simple dialog box:

Second, the script can create new InDesign files on the fly from the pages you extract ? InDesign’s Move Pages command can only move or copy pages from one InDesign doc to another one, not to a new one.

So, ExtractPages is handy script to have if, say, you’ve got a long multi-chapter book in a single InDesign document that you want to quickly split into multiple InDesign files, one document per chapter. This is something you need to do if you want to export a book to ePub and have the chapters start on their own pages, for example.

It’s possible to use Move Pages to do this manually (just set up a starter InDesign file for each chapter beforehand), but that means you have to laboriously match page dimensions and other attributes, and then remember to delete the additional, superfluous starter page in each of those files afterwards. You don’t need to bother with that if you use the script.

ExtractPages has one weirdness that can throw you: Not only doesn’t it automatically open the new INDD file(s) it creates, it closes the source document as soon as you run the script. If there were unsaved changes, they’re gone.  (This happened to me during testing on a Mac w/CS4, your mileage may vary.) So if you want to use it, be sure to save your source document first, at least until the script’s author fixes it.

Download ExtractPages script from its Scriptopedia page or directly by clicking here .

Related Articles
Comments

38 Comments on “Free Script Splits Long InDesign Files into Smaller Ones

  1. “at least until the script?s author fixes it.”

    Well, some work to do :-)

    Ps: I have to admit that Laurent Tournier pointed me another bug that I didn’t have time yet to fix.
    The script works very fine with standalone documents but not so efficiently with books.
    This article is an occasion to me to fix both issues :-)

    Thanks a lot for your article I am very honoured.
    BTW, if anyone else has a wish, that’s the moment.

    Loic

  2. Just tried it on a document that had facing pages and connected text frames.

    It also had running headers on master pages, but manually inserted running heads too (Months being inserted which couldn’t be done automatically)

    Text isn’t removed from the text frame, so every document (24 documents) have an overflowing text frame.

    Some running heads started overlapping the manually inserted running heads.

    Anchored images went wonky and appeared on some pages in the wrong place (overlapping text).

    The script is good, and it’s great that it does what it does. But there’s definitely of cleaning up to be done afterward.

  3. That´s a nice one, but I actually would need a script that would do vice versa; combine multiple documents to one indd.

    Those documents contains usually only one spread (with 2 pages)… I know that it´s possible to do with Move Pages feature, but it would be super cool to have a script for that…

  4. Ok, I am going to start fixing the problem Anne-Marie pointed out and will work on a new version with the improvements Eugene talked about.

    Petteri,
    I wonder if that script doesn’t exist already ? I am picking infos about that.
    Loic

  5. Loic, I saw that you have done a script called custompdfexport.jsx… what do you think, would it be hard to change to export SWF instead of PDF?

    I actually asked a combining script because I would like to export multiple indesign documents to SWF and now I have to combine them first manually to one indd…

  6. God, give me four more arms !!!

    Petteri, I was asked on an other side to do so.
    Then the answer is, I am on it.

    I will try to release that asap.

    Loic

  7. Eugene: I tried the same thing with the threaded frames, and saw what you saw. I think the script is still useful as is for when you’re breaking a long doc along “natural” fault lines ;-) like in between wholly-contained chapter threads. Didn’t think to test anchored objects … hmmm.

    Would be cool to integrate the Break Frames script with this one. So that when the user enters a page number in the ExtractPages dialog, the script runs the break frames routine, if/as necessary, at the page numbers entered.

    How many more arms do you need, Loic? ;-)

  8. Anne-Marie: I was thinking the same thing, the script runs the Break script first then goes about it’s business. Of course would need this to be non-destructive to the document I am splitting up.

    I’ve sent Loic a file that isn’t neat at all in terms of layout, i.e., I took a few shortcuts due to time contraints and just plonked text frames on pages, but I’ll never need this layout again and if I do I can probably fix it up so it works better.

    The problem is when you have loose text frames and running heads that are aligned away from the spine. As that’s how I set them up, no point in two styles for left and right pages anymore.

    Yet the script would put some left pages on right pages, as it’s a new document, and 1 being a right page.

    So loose text frames and running heads go askew.

    And that’s why I choose that file to run the script on because I knew it was setup incorrectly, and that’s how I imagine a lot of people set up files when they’re in a hurry.

    The script needs to cater to everyone of all skill levels lol :D

    Well that’s just what I think. Of course if I’d setup the document correctly it probably wouldn’t be an issue.

    I have an even more complicated document that goes completely haywire when I add or delete a page, as some items are anchored, some are not and it’s just completely bezerk.

    The script is definitely great, and if I needed to move chapter by chapter out of a document this would be the ticket as long as you incorporate the entire story in the page selection.

    Currently though when I try to extract all pages as single documents it keeps the text and anchored objects. So the Break script running first would sort that out.

  9. Thanks, that would be very helpful script. I have lot´s of cases where my publication is in small peaces. Like one spread in one indd-file.

    Now I have to combine them manually before I can export my SWF.

    If you do that script, I could give you a free license of eDocker for change. For creating user functions for SWF files.

  10. I’m afraid for me this script isn’t really doing anything. It does generate a new document, but the new document has all the pages in it that the old one has. It wipes out all but one or two of the pages, but the text is still all there when I insert a new page and reflow the text. And when I told it to extract page 3 and then remove it after extraction, it saved the file with the new name, but when I opened it, I was back to page 1 and all the rest of the text was still there. This is a 36-page piece of a larger document in which all the text is a single text flow.

    Perhaps I’m doing something wrong?

    Thanks.

    Phil Frank

  11. Hi Phil,
    I was told some things were not optimal but your case is very problematic.
    Do you mind sending me your file so I can test it at home.
    I am working on a new version that should fix all the problems and your file may help in that goal.

    TIA Loic

  12. I have to say, I’ve been searching for a script like this for quite sometime and it’s been a godsend to me while working on a rather complex document.

    One thing I have found with the script is that the page numbers it uses aren’t exactly correct. It seems to use the number of the page itself in the context of the first page, as opposed to the document’s page numbers.

    For example: Assuming the first three pages of your document were numbered using roman numerals (I, II, III), then pages started from 1 onwards.

    Now say you want to export pages 13-18. Logically you would expect to type in 13-18 in the export dialogue, but this will actually give you pages 10-15 of the document.

    The reason is that the roman numerals or non-standard page numbers are being treated as pages.

    None the less, great work and just remembering some simple checking before exporting overcomes the above problem.

  13. Hi,
    I have a document where there are several section breaks with a new pagination, and I get an error at line 291. I think this is due to the script looking for the absolute page numbers vs. the named page numbers (I only use applescript so the approximate is the property called “name” for each page.

    Ah, well. Thanks anyway.

  14. This gets me every time – I always forget – threaded stories on multiple pages give me problems. If you are extracting pages with this script and getting wrong pages or only pages starting from beginning – then you probably have threaded stories across page boundaries. There is an Adobe supplied script called “Split Story” that can split your story and then this script works fabulously.

  15. I am getting the following error when I run the script:
    ReferenceError: App.local.toLocaleName is not a function

    I updated the script with “make it run” already. I am trying to run the script on a 48 page document with facing pages in CS6. Any help would be greatly appreciated.

    If I can’t get the script to run, does anyone have a suggestion on a work-around? My assumption is that I will have to create 48 new documents, placing a single page in each document. Does that sound right?

    • I know this is an older thread, but i’m having this same problem (the Javascript error of “ReferenceError: App.local.toLocaleName is not a function”). did you ever get a resolution to this?

  16. Why am I getting this? I’m following directions. [in Windows 7. InDesign CS5. Trying to run it on extractpages. jsx - hadn't run this file before. Trying to update it to CS5 to extract pages for fixed EPUB. It makes a new file but gives me this error:] “Error. No file is associated with current script.”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>