Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Jun 10, 2008 Jun 10, 2008
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?
TOPICS
Scripting
5.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 15, 2008 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2008 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 16, 2008 Jun 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 ?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 16, 2008 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 16, 2008 Jun 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 ?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 16, 2008 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 16, 2008 Jun 16, 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 17, 2008 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 18, 2008 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 18, 2008 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 24, 2008 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 03, 2015 Feb 03, 2015
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 24, 2008 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines