Skip to main content
Participating Frequently
June 10, 2008
Question

Multi-page InDesign document to single-page InDesign documents script?

  • June 10, 2008
  • 36 replies
  • 5910 views
I'm looking for a script that can take a multi-page Mac InDesign CS2/CS3 document and split it into single-page InDesign documents. Any ideas or comments?
This topic has been closed for replies.

36 replies

Participating Frequently
June 24, 2008
Loic,

On the TRL document in previously sent you, the script seems to work great! When I run the script on the document I just emailed you (which is much more complexed), some misc. items are getting placed on top of other items on some of the pages.

FYI, I found out last week that our company is closing down our operations branch. So, I regret to inform you that I will no longer need this script. I thank both Peter and yourself on all your hard work on this script. I wish I could compensate you in someway, but our finance's are frozen.
Thanks again, Mike
Loic.Aigon
Legend
June 24, 2008
http://dl.free.fr/kJOvckC4m/extractpages_test2.jsx

Hi,
Finally, I chose to develop the delete,save & reopen approach.
I guess it may take a long time to operate on long documents but that's the simpliest way.
Let me know if you think about any improvements.
Loic
sledge76
Participant
February 3, 2015

Loic,

I've just come across your Extract Pages Script. I'm using the 10.1.0.71 CC version of InDesign. When I try to use your script, it says there is an error on line 87. That line is:

String.L10N = File(app.activeScript).

Do you know how that line should be changed to make this compatible? This script seems to be what I need. It would be great to get it up and running.

Thanks in advance.

Known Participant
June 18, 2008
This is very quick.
In CS3 will be more quick.

Just save it.

var lim = Number.MAX_VALUE;
var k = 0;
for(i = 0; i < lim; i++){
doc = app.open(file, false);
pages = doc.pages;
if(lim == 1Number.MAX_VALUE){
lim = pages.length;
}
page = pages;
if(i == 0){
sufps = pages.itemByRange(1, -1);
if(sufps != null){sufps.remove();}
}else{
if(i != lim-1){
pages.itemByRange(i+1, lim-1).remove();
}else{

}
doc.save(newFile);
}

jxswm
Known Participant
June 18, 2008
Sorry I'm coming in at the end of a discussion, but there was not enough input from the O.P. Mike. Are we working on a folder of multiple ID files, or just one? Do we need to export all pages of documents or just a range? What platform is needed? Generally how many pp per document, how many documents? Cleanup needed on master pages or swatches etc?

I'm talking in Applescript here.
Do master pages really need deleted? If not, then no problem, just leave them in. My guess would be to just have your original ID docs in a folder, and an output folder. Start a script, select your input and output folders. Script grabs first document, counts number of pages. Repeats X number of times. Delete pages except the page of current loop, do a Save-As into output folder with new doc name. Reopen (or undo) and repeat page deletion and Save-As with new name. Go to next loop with next original document.
I've written a bunch of loops that do some of these basic functions. I can't see that trying to duplicate the page structure on a new document would be very efficient in any language. Seems like too many pitfalls that could snag you, like master page items or locked items or document preferences you have to account for.
Even with my script there may be text flow issues with linked boxes.

Mike, any additional input on what you need? Thx
Loic.Aigon
Legend
June 17, 2008
Hi jxswm,
I think that this is a convenient way of thinking for exporting a range of pages into one single document.
Exporting n pages to n documents will be, in my opinion, too time consuming. That was the way I was thinking first but what appeared as a issue at the time was that it was multiplying operations again & again and that could result a very slow script.
I mean, I should have removed pages through a loop, then save for the first page. Either undo till I got the document as its first state or better reopen the doc. Then remove again, resave, reclose, reopen,etc.
And if you have a 200p documents, it might be a good option, I think.
However, I may be wrong thinking that.
Loic
Known Participant
June 17, 2008
If there are no linked textFrames between pages, then just remove other pages and leave only one page, then save as new indd file.

do this action doc.pages.length times,this will get the right result.

jxswm
Loic.Aigon
Legend
June 16, 2008
Peter,
It seems that there is a lead with
pageItems.overriddenMasterPageItem
So I can think about a loop which will analyze all the pageItems, check if they have been overridden, then if true, identify parent master name, override the pageItems on the page then remove it.

Tricky but it should work.

Loic
Loic.Aigon
Legend
June 16, 2008
Ok, I believed interchange could handle page range, my mistake.
Anyway, the script is quite a good basis after all.
If I am not wrong, the worst that can happen is that a page items is doubled (once in the page, once in the master).
The script may cover fine a lot of jobs and may request some manual adjustements with the exported files once in a while.
Loic
Hey, Mike, did you try it ?
Peter Kahrel
Community Expert
Community Expert
June 16, 2008
>the simpliest should have been a export to indesign interchange

I thought of keeping everything in one file and at some stage export individual pages to PDF. INX is not suitable here because you can't export individual pages.

Peter
Loic.Aigon
Legend
June 16, 2008
Hi Peter,
I saw this problem this morning at work. Indeed, it seems that the more I get close from the solution, the more problems I discover.
But I won't surrender so fast ;-)
Well, I will have a look on it as soon as possible.
Loic
PS : I thought that afterall, the simpliest should have been a export to indesign interchange. But it wouldn't have preserved CS3 specific elements, am I wrong ?