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

Loic.Aigon
Legend
June 12, 2008
Hi Mike, I will give a try. It only really depends on my amount of work these days, I can't warranty quick action. I am not myself a great scripter so I have first to fully understood Peter's logic before linking to the dialog.
Will do my best on this topic as soon as possible.
Loic
Participating Frequently
June 12, 2008
Peter,
Yes, an interface would be great.
Loic, can you add Peter's script to your interface?
Mike
Peter Kahrel
Community Expert
Community Expert
June 12, 2008
Probably. As Loic said, his script provides an interface. Do you need one? If yes, Loic is welcome to add my script to his interface.

Peter
Participating Frequently
June 12, 2008
Peter,
I'm not a scripter and was wondering if you could link Loic's script with yours. Is this possible?
Thanks for everyone's input and work on this script.
Mike
Loic.Aigon
Legend
June 12, 2008
Hi, Peter and Mike,
I wrote the dialog for using your script. It just needs to be linked now.
Here is the dialog. With a little help from you guys, we could get a satisfying result.
http://minilien.com/?bplmVXMlpX
Loic
Peter Kahrel
Community Expert
Community Expert
June 11, 2008
This script seems to do the job: create a document with the same dimensions as the original (called "temp" here), then duplicate a page from the source document to temp and save temp. Continue with remaining pages. "Start" and "stop" are the first and last pages of the range to be saved. The script doesn't deal with section prefixes.

start = 102;

stop = 112;

doc = app.activeDocument;
tempdoc = create_temp (doc, 'temp');
docname = String(doc.fullName).replace (/\.indd$/, "");
for (i = start; i <= stop; i++)
{
$.writeln (i);
doc.pages.item(String(i)).duplicate (LocationOptions.before, tempdoc.pages[0]);
tempdoc.pages[1].remove();
tempdoc = tempdoc.save (File (docname + '-' + String(i) + '.indd'))
}
tempdoc.close (SaveOptions.no)

function create_temp (doc, n)
{
var temp = app.documents.add ({name:n});
with (temp.documentPreferences)
{
pageHeight = doc.documentPreferences.pageHeight;
pageWidth = doc.documentPreferences.pageWidth
}
temp.importStyles(ImportFormat.paragraphStylesFormat, File (doc.fullName));
return temp
}


Peter
Loic.Aigon
Legend
June 11, 2008
Hi Mike,
Page range is not a issue. What matters most now is to determine the smartest process to achiev your task.
The quickest seems to be Peter's one cause operations are limited in time but it implies to add code for page setup consideration, pageitems positions...
My way is more faithfull cause we just drop the pages we don't need but it asks for a lot of repetitive actions that are going to slow down the script in a way I can't even represent myself specially if you have a big document. On the other hand, your files are perfect clones.
Nevertheless, It would probably need control loops for removing masters that are not used anymore, colors, etc. Or the file may be uselessly weigth.

So if you are certain not to need specific modifications of the sperated pages, we should develop Peter's reflexion. Or if the pages must be workable template with masters, rulers and any other things that you don't want to reproduce every time, we may have to go my way.

Loic
Participating Frequently
June 11, 2008
Yes, I do have the export to PDF script, and it works great, but, we have this speciality project that requires these multiple page InDesign docs we receive to be separated into single page docs for this project. It would be great if the script could also contain the ability to split these multiple page docs into specified page ranges also. Would this be possible also?
Loic.Aigon
Legend
June 11, 2008
Hi Peter,
You may be right. After all, this export script may be used only in a final term where no more modifications are really wanted.
Actually, we can really wonder the even need of this action. I mean why to create separate indesign if there is no further modification.
Maybe Mike should rather export pages to individual PDFs.
This kind of export to pdf script is quite common on the web.
Mike, what do you think ?
Loic
Peter Kahrel
Community Expert
Community Expert
June 11, 2008
Loc,

>Leading this way, don't we loose layers, rulers, stuff that we might need?

That's true. But by the time you save a document page by page i doubt that they are needed. Anyway, they could be included as well I guess.

Peter