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

Peter Kahrel
Community Expert
Community Expert
June 16, 2008
This is not as straightforward as it seems. The problem is in the master-page items: some are overridden, others are not. When you save a page from a document, you want to include the master-page items that have not been overridden on the page, but you must exclude the master-page items that have been overridden. And there's the rub: how to tell them apart. You could try to solve this by comparing geometric bounds, but in many cases, overridden items have been moved or resized, so there's no way (none that I can think of, anyway) to relate those items to a master-page item.

Loic -- despite your best efforts, your version will have the same problem.

Peter
Loic.Aigon
Legend
June 15, 2008
Hi guys,
I am closed from a final version. This one is quite really operational.
However, I need to fix some stuff.
Setting range to one page (2 to 2 for ex) bugs the script.
I placed a control for the removing pages loop as a document must contain one page at minimum. However, the script duplicates the page that is going to stay on the genuine document. The best should be that this first page is not duplicated then renamed as document_P1.indd.
I have not dealt with sections at all. we can consider them in a second phasis.
A great thanks to Peter Kahrel, I used mainly your code as the skeleton of the whole script. Whatever the lead I tried to study, your way was always the simplier after all. And the fact is that is much more reliable and faithful than I expected. Either layers, rulers are kept.
A final effort and this script will be over.
Loic
http://dl.free.fr/eS6jMQURS/extractpages.jsx
Peter Kahrel
Community Expert
Community Expert
June 13, 2008
Mike -- I didn't receive anything. You need to send it to the address you see when you click my name.

Peter
Participating Frequently
June 13, 2008
Peter,

I don’t know if this email will get to you, but I’ve attached a compress IND doc for you to test your script on. I did get the script to generate the desired range  of pages to be extracted, but these extracted pages are blank when I open them. Let me know if you get the same results.

Thanks, Mike
Peter Kahrel
Community Expert
Community Expert
June 13, 2008
Mike,

>I really didn't understand your previous instructions.

There weren't any, I don't think :)
What you did was correct -- what goes wrong is not so clear. What should happen is this: say the document from which you want to save pages as individual files is called 'test.indd', and that you want to extract pages 1 to 10. The script should create ten new files, named test-1.indd, test-2.indd, ..., test-10.indd, all in the same folder as test.indd. These documents aren't kept in memory.

As to what goes wrong, that's less clear -- it works fine over here. The script works in CS3, not CS2, but you must use CS3 because in CS2 it would generate an error. Do you use section prefixes for the numbers? That could be a problem (easily solved). Maybe you could send me a document, that way it's easier for me to see what goes wrong.

Peter
Participating Frequently
June 13, 2008
Peter,
I'm not sure how to run your script. I really didn't understand your previous instructions. I edited your script by entering start=1; and stop=10 and put the edited script in the script folder within InDesign application. I opened a multiple page InDesign document containing 30 pages. I then double-click the script in the script palette hoping to see 1-10 pages extracted from the 30 page document, but nothing happens. Could you explain what I'm doing wrong and where the extracted pages would be saved to? I'm very new to using scripts in InDesign.
Loic,
Adding a checkbox option to the interface for saving the split documents to specific folder would be great. We plan on using this script many times a year and yes, once this is completed, I plan on paying both Peter and yourself for your hard work on this. Thanks again, Mike
Loic.Aigon
Legend
June 13, 2008
Hi Peter,
No offense, don't worry. You know I am surrounded with code engeneers. I am well placed to know that sometimes they have a really cartesian point of view. If it's not logical for them, it can't be for anyone :-)
But as I am more of a end user, I am more asking for ergonomic stuff. Probably weighter but so cumfy when using it.
If I was paid, I should have to refund you for 75% of the amount :-)
Loic

Mike, I will give a try but I can't warranty you any term.
Peter Kahrel
Community Expert
Community Expert
June 13, 2008
Loic,

I didn't say that a dialog wouldn't be useful, just that it didn't seem necessary. As I said, all he needs to do is change two numbers and press F5 to run the script. Interfaces usually take much more code than the functional part of the script (the interface you wrote, linked in post 12, is about three times bigger than myscript!) so I don't bother with them for myself.

Anyway, Mike has a working script now. If he wants a fancy interface to go with it, maybe he should offer you to pay for it.

Peter
Loic.Aigon
Legend
June 13, 2008
Hi Peter,
I guess dialog is not such indispensable if the script is used only once in a year.
However, as Mike does not know scripting and in case he needs to use the script quite often, it may be convenient to use a dialog. Besides, it could be interesting to take advantage of a dialog for specifying separation and removing options such as acrobat offers to.
I thought this morning that maybe I could add a checkbox implying either the files are automatically saved in the genuine folder or allow the user to point a specific folder.
Most of all, I worked a little on this topic a few months ago for my own purpose before I misteriously abandoned it. So I have a special interest to achieve this script.
Just to know, when you mean dialog is not useful. It implies that if you want to specify the range, you have to open the script in a text editor then save it and finally launch it from Indesign, that's right ?
Loic
Peter Kahrel
Community Expert
Community Expert
June 12, 2008
The script doesn't really need an interface. All you need to do is enter the range of pages that need to be saved as separate ID docs: at start, the first page of the range, at stop, the last one. That's all. An interface would just pop up a dialog asking you to enter the first and last pages of the range.

Peter