31 Replies Latest reply: Feb 24, 2013 12:04 AM by myDwayneSmith RSS

    Create separate indesign documents for each page of a document

    blasto333 Community Member

      I am converting a print indesign file for use with dps. The problem is DPS wants individual files for each page. Is there a script to take each page and save as an indesign file?

        • 1. Re: Create separate indesign documents for each page of a document
          Green4ever Community Member

          Yes. Our fellow scripter wrote a script for this, please check this site more details....

           

          http://www.loicaigon.com/en/auto.php?goTo=2

           

          See to the Extract Pages script (5 th script I think)

           

          Thanks,

          Green4ever

          • 3. Re: Create separate indesign documents for each page of a document
            myDwayneSmith Community Member

            G'day

             

            You could start with something like this :

            tell application "Adobe InDesign CS4"

                set enable redraw of script preferences to false

                activate

                set dsDoc to active document

                set dsDocProps to properties of document preferences of dsDoc

                set pages per document of dsDocProps to 1

             

                set dsFilePath to (full name of dsDoc) as text

                set text item delimiters of AppleScript to "."

                set dsFilePath to text 1 thru text item -2 of dsFilePath

                set text item delimiters of AppleScript to ""

             

                set dsPageCount to (count of pages of dsDoc)

             

                repeat with w from dsPageCount to 1 by -1

                    set dsNewDoc to make new document with properties {document preferences:dsDocProps}

                    duplicate page w of dsDoc to after page 1 of dsNewDoc

                    set active document to dsNewDoc

                    delete page 1 of dsNewDoc

                    save dsNewDoc to (dsFilePath & "_" & w & ".indd")

                    close active document

                    delay 1

                end repeat

                close dsDoc saving no

            end tell

             

            m.

             

            Message was edited by: myDwayneSmith

            Sorry,  just posted this before seeing the 5.5 thing — should still work if you update the version number in the first line.

            You might need to change "set dsFilePath to (full name of dsDoc) as text" to "set dsFilePath to (full name of dsDoc) as string"

            • 4. Re: Create separate indesign documents for each page of a document
              drewford499 Community Member

              I've downloaded the file that Green4ever suggested, but it doesn't seem compatible with CS5.5.Does any one happen to know if something in the script can be altered so this works on CS5.5?

               

              Thanks -

              • 5. Re: Create separate indesign documents for each page of a document
                Green4ever Community Member

                you can try this....

                //**************************************************************************************************************
                //**************************************************************************************************************
                //****
                //****    Page extractor 1.0 - A script from Loïc Aigon with the great help of Peter Kahrel and other guys
                //****    that cooperated on this stuff in tha adobe scripting forum. Feel free to improve. 
                //****    a little mail at loic _ aigon@yahoo.fr if you appreciate that script would be nice.
                //****
                //**************************************************************************************************************
                //**************************************************************************************************************
                
                //======================================
                // <L10N> :: FRENCH_LOCALE :: RUSSIAN_LOCALE
                //======================================
                // Please save you file first before processing the script :: Enregistrez votre document avant de lancer le script :: Пожалуйста сохраните документ перед запуском скрипта
                // Extract pages... :: Extraire des pages... :: Извлечь страницы...
                // to :: a :: по
                // Extract as separate pages :: Extraire chaque page comme un fichier :: Извлечь как отдельные страницы
                // Remove pages after extraction :: Supprimer les pages après extraction :: Удалить страницы после извлечения
                // Choose other extraction folder :: Choisir un autre dossier d'extraction :: Выбрать папку для сохранения
                // </L10N> ::
                
                
                // 2. Add the code's block below in your script:
                
                if ( typeof __ == 'undefined' )
                {
                __sep = ' :: ';
                __beg = ' <L10N>';
                __end = ' </L10N>';
                
                /*arr*/File.prototype.getCommentsContaining = function(/*str*/k_)
                //--------------------------------------
                    {
                    var r = [];
                    if ( this.open('r') )
                        {
                        var line;
                        while(!this.eof)
                            {
                            line = this.readln();
                            if ( ( line.substr(0,2) == '//' )
                                && ( line.indexOf(k_) >= 0 ) )
                                r.push(line.substr(2));
                            }
                        this.close();
                        }
                    return(r);
                    }
                    
                /*arr*/Array.prototype.parseL10N = function(/*str*/locale_)
                //--------------------------------------
                    {
                    var r = [];
                    var sz = this.length;
                    var lm, ss;
                    var st = -1
                    var rg = 0;
                    for ( var i=0 ; i < sz ; i++ )
                        {
                        ss = this[i].split(__sep, lm);
                        if ( ( st == -1 ) && ( ss[0] == __beg ) )
                            {
                            lm = ss.length;
                            for ( var j = 1 ; j < lm ; j++ )
                                if ( ss[j] == locale_ ) rg=j;
                            st = 0;
                            continue;
                            }
                        if ( st == 0 )
                            {
                            if ( ( rg == 0 ) || ( ss[0] == __end ) ) break;
                            if ( ss.length <= rg ) continue;
                            r[ss[0].substr(1)] = ss[rg];
                            }
                        }
                    return(r);
                    }
                
                /*str*/Object.prototype.toLocaleName = function()
                //--------------------------------------
                {
                for ( var p in Locale )
                    if ( Locale[p] == this ) return(p);
                return(null);
                }
                
                String.L10N = File(app.activeScript).
                    getCommentsContaining(__sep).
                    parseL10N(app.locale.toLocaleName());
                    
                function __(s){return(String.L10N[s]||s);}
                }
                
                // 1. Control for documents open. If true, the script launches the dialog
                
                if(app.documents.length >0)
                {
                    var doc = app.activeDocument;
                    if(doc.saved==true)
                    {
                        extractdlg();
                    }
                    else
                    {
                        alert(__("Please save you file first before processing the script"));
                    }
                }
                else
                {
                    alert("No documents open !"); 
                }
                
                
                
                
                
                
                
                
                // 2. Gathers many infos on the document.
                
                function pageinfos()
                {
                    var pg = doc.pages;
                    var pglg  = pg.length;
                    var pFirst = Number(pg[0].name);
                    var pLast = Number(pg[pglg-1].name);
                    var pgHeigth = doc.documentPreferences.pageHeight;
                    var pgWitdh = doc.documentPreferences.pageWidth;
                    var docname = String(doc.fullName).replace (/\.indd$/, "");
                    var docpath = doc.filePath;
                    var docfullname = doc.fullName;
                
                    var infoarr = [pglg, pFirst, pLast, pgHeigth,pgWitdh,docname,docpath,docfullname];
                    return infoarr;
                }
                
                
                // 3. Main function. First part is the dialog
                
                function extractdlg()
                {
                    var docfile = String(pageinfos()[7]);
                    var dlg = app.dialogs.add({name : "Pages Extractor 1.0 - ©www.loicaigon.com"}); 
                    with(dlg)
                    {
                        var firstclmn = dialogColumns.add();
                        with(firstclmn)
                        {
                            var firstrow = dialogRows.add();
                            with(firstrow)
                            {
                                var clmn1 = dialogColumns.add();
                                with(clmn1)
                                {
                                    var row1 = dialogRows.add();
                                    row1.staticTexts.add({staticLabel : __("Extract pages...")});
                                    var row2 = dialogRows.add();
                                    with(row2)
                                    {
                                        var r2c2 = dialogColumns.add();
                                        with(r2c2)
                                        {
                                            var r2c2r1 = dialogRows.add();
                                            var pgStart = r2c2r1.realEditboxes.add({editValue:pageinfos()[1], minWidth: 30});
                                        }
                                        var r2c3 = dialogColumns.add();
                                        with(r2c3)
                                        {
                                            var r2c3r1 = dialogRows.add();
                                             r2c3r1.staticTexts.add({staticLabel : __("to")});
                                        }
                                        var r2c4 = dialogColumns.add();
                                        with(r2c4)
                                        {
                                            var r2c4r1 = r2c4.dialogRows.add();
                                            var pgEnd = r2c4r1.realEditboxes.add({editValue:pageinfos()[2], minWidth: 30});
                                        }
                                            
                                    }
                                }
                            }
                            var secondrow = dialogRows.add();
                            with(secondrow)
                            {
                                var clmn2 = dialogColumns.add();
                                with(clmn2)
                                {
                                    var row2 = dialogRows.add();
                                    with(row2)
                                    {
                                        var sepbox = checkboxControls.add({staticLabel:__("Extract as separate pages"), checkedState:false});
                                    }
                                }
                            }
                            var thirdrow = dialogRows.add();
                            with(thirdrow)
                            {
                                var clmn3 = dialogColumns.add();
                                with(clmn3)
                                {
                                    var row3 = dialogRows.add();
                                    with(row3)
                                    {
                                        var rembox = checkboxControls.add({staticLabel:__("Remove pages after extraction"), checkedState:false});
                                    }
                                }
                            }
                            var foutrhrow = dialogRows.add();
                            with(foutrhrow)
                            {
                                var clmn4 = dialogColumns.add();
                                with(clmn4)
                                {
                                    var row4 = dialogRows.add();
                                    with(row4)
                                    {
                                        var savebox = checkboxControls.add({staticLabel:__("Choose other extraction folder"), checkedState:false});
                                    }
                                }
                            }
                        }
                    }
                
                    // If the user made good choices, the script operates.
                    
                    if(dlg.show()==true)
                    {
                        if(pgStart.editValue >= pageinfos()[2] || pgEnd.editValue <= pageinfos()[1])
                        {
                            alert("The pages numbers may be at least "+pageinfos()[1] +" for the first page of the range and "+ pageinfos()[2] + " at maximum for the last page");
                        }
                        else
                        {    
                            // If the user choose to pick a different folder, he will be asked for. Otherwise, the dafault folder is the one containing the file.
                            if(savebox.checkedState==true)
                            {
                                var extractfolder = Folder.selectDialog ("Please choose a folder where to save extracted pages...");
                                if(!extractfolder)
                                {
                                    exit();
                                }
                                else
                                {
                                    var saveextractfolder = String(extractfolder.fullName)+"/" +String(doc.name).replace (/\.indd/, "");
                                }
                            }
                            else
                            {
                                var saveextractfolder = String(pageinfos()[5]);
                            }
                            var rem0 = pageinfos()[0]-1;
                            var rem2 =  (pgStart.editValue-2);
                            
                            // Variables definition regarding to the choice of the user to separate or not the extracted pages.
                            
                            if(sepbox.checkedState==true)
                            {    
                                var W = pgEnd.editValue-pgStart.editValue+1;
                                var rem1 = pgStart.editValue;
                            }
                            else
                            {
                                var W = 1;
                                var rem1 = pgEnd.editValue;
                            }
                            
                            // Extraction loop 
                            for(w=0; w<W;w++)
                            {
                                if(sepbox.checkedState==true)
                                {
                                    var exportdocname = "_Pg" +(pgStart.editValue+w) +".indd";
                                }
                                else
                                {
                                    var exportdocname = "_Pg"+pgStart.editValue+"_to_Pg_"+pgEnd.editValue +".indd";
                                }
                                for(var i=rem0; i>=rem1+w;i--)
                                {
                                    doc.pages[i].remove();
                                }
                                for(var i=rem2+w; i>=0;i--)
                                {
                                    doc.pages[i].remove();
                                }
                                var exportdoc = doc.save(File(saveextractfolder + exportdocname));
                                exportdoc.close(SaveOptions.no);
                                if(sepbox.checkedState==true && w<(pgEnd.editValue-pgStart.editValue))
                                {
                                    app.open(File(docfile));
                                }
                            }
                        
                            // If the user chose to remove the extracted pages from the original document, it will re open the first document then remove the unuseful pages.
                            if(rembox.checkedState == true)
                            {
                                app.open(File(docfile));
                                for(var i=pgEnd.editValue-1; i>=pgStart.editValue-1;i--)
                                {
                                    doc.pages[i].remove();
                                }
                                app.activeDocument.close(SaveOptions.yes);
                            }
                        }
                    }
                }
                

                Note: I have not tested all the features of this script.

                • 7. Re: Create separate indesign documents for each page of a document
                  drewford499 Community Member

                  Thanks! Well, it's almost working, I think. I used the new script that Green4ever posted above this last comment and created a new .jsx document. I loaded it into Indesign CS 5.5 and then ran the make-it-run script suggested above (it doesn't work at all without using the make-it-run script). Here's what happens:

                   

                  It extracts one page (even though I set it for all 12 of my pages to make individual pages) and then gives me an error saying:

                   

                  ReferenceError: Object is invalid

                   

                  I'm not sure what this means or how to fix it. Does anyone else?

                   

                  Continued thanks -

                   

                  best,


                  Drew

                  • 8. Re: Create separate indesign documents for each page of a document
                    Rogier Parijs Community Member

                    Hi drewford,

                    I think you should convert the original old script by loic.

                    The makeitrun-script makes a separate script that instructs INDCS5.5 how to run the old script.

                    Works flawlessly for me..

                    • 9. Re: Create separate indesign documents for each page of a document
                      paper1246 Community Member

                      Hi,

                       

                      I am attempting to use the extract pages script in InDesign CS6. I ran the "Make it run" script to update the extract pages script and then attempt to run the new script on the 64 page document.  I am gettign the following error message:  "Error: no file is associated with the currently active script."  Does anyone have a suggestion?

                       

                      Thanks,

                       

                      Paul

                      • 10. Re: Create separate indesign documents for each page of a document
                        Green4ever Community Member

                        Did you ran the script from ESTK? Try running it from scripts panel.

                        • 11. Re: Create separate indesign documents for each page of a document
                          kellybellis Community Member

                          @ Green4ever - that's interesting you suggest that as I've been wondering why that seems to make a difference in some cases and not in others. Please elaborate if you're able as to why a script will run flawlessly from the InDesign Scripts panel but gets all constipated in ESTK?

                          • 12. Re: Create separate indesign documents for each page of a document
                            drewford499 Community Member

                            Thanks for the response - am just now getting back to this. Loic's site is down as luck would have it. Is it at all possible to post the script (here in this thread) that is working for you in CS5.5?

                             

                            best,

                             

                            Drew

                            • 13. Re: Create separate indesign documents for each page of a document
                              myDwayneSmith Community Member

                              G'day Drew

                               

                              What is it that you're trying to do that doesn't work with the script I posted?

                              It might be possible to adapt that script to your needs.

                               

                              m.

                              • 14. Re: Create separate indesign documents for each page of a document
                                drewford499 Community Member

                                Hi -

                                 

                                Thanks for the response. Full disclosure: I don't code. Maybe this is a simple fix... I just don't know.

                                 

                                I'd love for the script to be able to separate out each InDesign page in a file (and in a perfect world, allow me to rename each one it separates out, since my client is very particular about how files are named... but the splitting out is primary goal for now).

                                 

                                When I create a new jsx file with the code you posted I get this error message:

                                 

                                Error Number: 25

                                Error String: Expected: ;

                                 

                                Engine: main

                                File: /Applicaitons/Adobe Indesign CS5.5/Scripts/Scripts Panel/Samples/JavaScript/dwayne_Smith.jsx [I obviously named the script after you ha]

                                Line: 1

                                Source: tell application "Adobe InDesign CS5.5"

                                Offending Text: application

                                 

                                I'm not sure where to go from there. I don't have enough perspective in Code Land to understand why the things I try to do to fix it don't work - like taking out the word "application" or other uninformed things)

                                 

                                Thanks for any help you can provide

                                 

                                best,

                                Drew

                                • 15. Re: Create separate indesign documents for each page of a document
                                  myDwayneSmith Community Member

                                  OK — the script I posted is Applescript, not Javascript — so it's only useful if you're on a Mac.

                                  Copy and paste it into AppleScript Editor which you'll find in Appications > Utilities (in older versions of OSX it's called Script Editor and it's in a different folder in Applications)

                                   

                                  Change the first line to :

                                      tell application "Adobe InDesign CS5.5"

                                  and change the 8th line to :

                                      set dsFilePath to (full name of dsDoc) as string

                                  you might also want to delete this line :

                                      close dsDoc saving no

                                   

                                  You can run it directly from the editor by hitting the green run button at the top (this will help you identify any issues yet to be resolved)

                                  Once you're happy with the way it runs, save it as a script (.scpt) into your Scripts Panel folder (will be somewhere like Applications > Adobe InDesign CS5.5 > Scripts > Scripts Panel)

                                  Then it will be available in your Scripts Panel in InDesign (double click to run)

                                   

                                  m.

                                  • 16. Re: Create separate indesign documents for each page of a document
                                    myDwayneSmith Community Member

                                    I should say — this is the barest minimum for this kind of task.

                                    It just takes a multi-page document and splits it into separate single-page documents

                                    So, BizCard.indd becomes BizCard_1.indd, BizCard_2.indd, etc.

                                    These are saved in the same location as the original.

                                     

                                    In its current form it doesn't :

                                    allow user to choose the new document names;

                                    allow user to choose a different location for new files;

                                    take into account InDesign's ability to have various page sizes;

                                    etc.

                                     

                                    Very basic functionality.

                                     

                                    m.

                                    • 17. Re: Create separate indesign documents for each page of a document
                                      drewford499 Community Member

                                      Whoa - that was it!

                                       

                                      I did have to take the semicolon out from the end of the script, because I got an error message - and now it works! I really appreciate your help! This will definitely save me some time.

                                       

                                      If only I could figure out how to be able to stop the script before it each time it names a file (so that I can name it myself) that would be amazing. I'll research a little on that and see what I might can do.

                                       

                                      Can't thank you enough

                                       

                                      Drew

                                      • 18. Re: Create separate indesign documents for each page of a document
                                        myDwayneSmith Community Member

                                        Glad it got you at least part way there.

                                         

                                        Have a look at this post — it gives an example of how to build a dialog for user input in InDesign : http://macgrunt.com/2011/11/26/indesign-scripting-lesson-11/

                                         

                                        Have fun with it.

                                         

                                        m.

                                        • 19. Re: Create separate indesign documents for each page of a document
                                          paper1246 Community Member

                                          Is there any chance that someone can point me to a script that would work for a Windows machine?

                                          • 21. Re: Create separate indesign documents for each page of a document
                                            kellybellis Community Member

                                            You may also want to read the section:

                                             

                                            About scripting languages

                                             

                                            in

                                             

                                            ADOBE INDESIGN CS6

                                            SCRIPTING TUTORIAL

                                             

                                            Requesting a script for "Windows" is rather unclear, but it will either be a JavaScript or a Visual Basic script; VBScript and

                                             

                                            "Translating a script from one

                                            language to another is fairly easy."

                                            • 22. Re: Create separate indesign documents for each page of a document
                                              jmsinc Community Member

                                              Can your script be edited easily to change the number of pages you can split into? Two pages is what I would use frequently, but I would like to figure out where to edit the script in case I need my file split differently. I am a total script novice, so excuse my lack of knowledge.

                                               

                                              And thank you for sharing yours!

                                               

                                              jm

                                              • 23. Re: Create separate indesign documents for each page of a document
                                                myDwayneSmith Community Member

                                                g'day jm

                                                 

                                                to separate out in sets of two you could change it to this :

                                                tell application id "com.adobe.InDesign"

                                                          set enable redraw of script preferences to false

                                                activate

                                                          set dsDoc to active document

                                                          set dsDocProps to properties of document preferences of dsDoc

                                                          set pages per document of dsDocProps to 1

                                                 

                                                          if page width of dsDocProps > page height of dsDocProps then

                                                                    set page orientation of dsDocProps to landscape

                                                          else

                                                                    set page orientation of dsDocProps to portrait

                                                          end if

                                                 

                                                          set dsFilePath to (full name of dsDoc) as string

                                                          set text item delimiters of AppleScript to "."

                                                          set dsFilePath to text 1 thru text item -2 of dsFilePath

                                                          set text item delimiters of AppleScript to ""

                                                 

                                                          set dsPageCount to (count of pages of dsDoc)

                                                 

                                                          repeat with w from 1 to dsPageCount by 2

                                                                    set dsNewDoc to make new document with properties {document preferences:dsDocProps}

                                                                    duplicate page w of dsDoc to after page -1 of dsNewDoc

                                                                    duplicate page (w + 1) of dsDoc to after page -1 of dsNewDoc

                                                                    set active document to dsNewDoc

                                                  delete page 1 of dsNewDoc

                                                                    save dsNewDoc to (dsFilePath & "_" & w & ".indd")

                                                  close active document

                                                  delay 1

                                                          end repeat

                                                end tell

                                                 

                                                 

                                                i had to add that new if statement because I noticed that CS6 was not getting the page orientation right.

                                                the other changes are to the repeat loop – it now increments by 2 and has an additional duplicate page line.

                                                the after page command has also been changed to '-1'. page -1 is the last page of the document, irrespective of how many pages there are.

                                                (all this should give you a bit of an idea of how you can adapt existing scripts to your specific needs).

                                                 

                                                if you wanted something more adaptable to various page ranges – or even multiple page ranges from the same document – you'd need to start playing around with user interfaces.

                                                you can see how i used such an approach to exporting pdfs here : http://macgrunt.com/2011/11/26/indesign-scripting-lesson-11/

                                                 

                                                hope that gets you started on a long and rewarding relationship with scripting

                                                 

                                                m.

                                                • 24. Re: Create separate indesign documents for each page of a document
                                                  scree131 Community Member

                                                  Thanks, myDwayneSmith. The script works quite nicely, especially since I am not a script writer. I wanted to put my images on separate pages in an ebook, to force the page break. BUT the resulting files each have the Pages Numbering and Section Options set to "Start Page Numbering at NN" ( where NN is the page number of the first page in the original section). So when the  files are gathered into a book, all the new files have the same page number. The orginal  file has the Automatic Page Numbering set, so not sure why this option gets changed. I can simply open each file and change the Page Numbering option, but it would be nice not to have to do that. Running 5.5. Any ideas?

                                                  • 25. Re: Create separate indesign documents for each page of a document
                                                    myDwayneSmith Community Member

                                                    G'day

                                                     

                                                    I assume you're using the book feature in InDesign to recompile the pages into one document (?).

                                                    In which case you should be able to 'Update Numbering' from the book panel dropdown menu.

                                                    (although I would expect this to happen by default when you first add the documents to the book)

                                                     

                                                    d.

                                                    • 26. Re: Create separate indesign documents for each page of a document
                                                      scree131 Community Member

                                                      Right. I am using the book feature to collect the pages into one document, in order to create a Kindle book. Without starting a new chapter, the only way to force a new page break in the exported ebook is to have a new file. Since pagination in an ebook is impacted by user settings (i.e. a large font size for reading), I can't always force the image and the associated caption to be on the same page (well, I could add the caption to the image in photoshop, and then it will be part of the image, but that doesn't always look right). If I force the page break with a new file, then I can effectively ensure the image and associated caption will always be on the same ebook page (unless they make the font really big!).

                                                       

                                                      And yes, when I add documents to the book, each page normally gets renumbered, or I can also renumber with "Update Numbering." But also normally the default setting for Numbering & Sections Options (right-click on page in Pages palette or select Document Numbering Options from the Books panel pulldown) is "Automatic Page Numbering." But for some reason, this changes to "Start Page Numbering at nn" when processed by the script. In other words, if the multi-page doc is pages 41-50, and then I run the script, I end up with 10 1-page docs (exactly what I want), except on each of the new docs "Start Page Numbering" is set to 41. Update Numbering does not seem to reset this. I have to change the Page Number option back to Automatic and then Update Page Numbering works fine.

                                                       

                                                      Running the script and then Changing the Page Numbering option in each doc is less work and less error-prone than manually breaking out each page, so I will happily take what I can get....

                                                      • 27. Re: Create separate indesign documents for each page of a document
                                                        myDwayneSmith Community Member

                                                        Oh yeah, I get what you mean now.

                                                        The only thing I can suggest at this stage is to remove the section starts before running the script.

                                                        Would this cause any issues considering you're recompiling the document anyway?

                                                         

                                                        d.

                                                        • 28. Re: Create separate indesign documents for each page of a document
                                                          scree131 Community Member

                                                          I'll have to play around with this. I haven't deliberately set sections, but my little bit of reading shows there may be something here.

                                                           

                                                          I do wonder if part of the key to this is the line in the script:

                                                           

                                                          set dsNewDoc to make new document with properties {document preferences:dsDocProps}

                                                           

                                                          If the current doc has the property "I'm on page 41", then wouldn't all new docs created have that property? (which is what seems to be happening). The Numbering & Sections Options dialog always seems to know the current page, so maybe ID regards that as a property?

                                                           

                                                          To directly answer your question, from an ebook standpoint, pages don't really matter, so yes I could just let the ebook creation process (what you are calling recompiling?) run, but I am trying to create a dual purpose document. I work for a (very) small publisher and the other guy handles print, and I handle ebook. Eventually, we want to be able to create one ID doc that serves both purposes with minor tweaks (we aren't there yet).

                                                           

                                                          With ebooks, the only way to force a page break is to start a new file. (Well, you can link a paragraph style to the HTML H1, but you only get to do that for one paragraph style. It's also how you create your ebook table of contents.) So you want your chapter to flow from start to finish, but you may want some things, like an image, to appear on its own page. That's why your script, to break up a bunch of image pages to ensure each appears on its own page, is so valuable.

                                                           

                                                          I will keep playing with this. Maybe the light will dawn.

                                                          • 29. Re: Create separate indesign documents for each page of a document
                                                            myDwayneSmith Community Member

                                                            Yes, I looked at that the other day in the scripting dictionary, but nothing struck me as useful. I was looking for something to reset the automatic numbering.

                                                            But having another look at it today I found that you can add another line :

                                                            . . . 

                                                            set pages per document of dsDocProps to 1

                                                                    set start page number of dsDocProps to 1

                                                            This will still give you the first document as page 41 — but all the others will flow sequentially from that.

                                                            Then you only need to update the start page for the first document in the book (rather than all of them).

                                                            At least, that's the way it's working for me in CS6

                                                             

                                                            Let me know how you go.

                                                             

                                                            d.

                                                            • 30. Re: Create separate indesign documents for each page of a document
                                                              scree131 Community Member

                                                              Well, the short version is WOOHOO!

                                                               

                                                              I turned off automatic page renumbering as it just slowed things down when adding the separate image pages back to the book. Adding the line above to the script caused all the new pages to be set to "1". BUT when I did a pull down of the Book pallette menu, and selected "Update Numbering", all the new docs renumbered just fine. I did not even have to update the first new doc. This script is going to be a biggie in my toolbox. Thanks!

                                                              • 31. Re: Create separate indesign documents for each page of a document
                                                                myDwayneSmith Community Member

                                                                Awesome — glad you got to where you were trying to go.

                                                                 

                                                                It's interesting that you are using this for exactly the same purpose as I originally created it — splitting docs up for ePubs.

                                                                That was a few years ago now and I found I still had to crack open the ePubs to fix them before re-zipping.

                                                                InDesign was plonking in a bunch of metadata that was causing the file to fail authentication.

                                                                Hopefully this is no longer a problem you have to deal with.

                                                                 

                                                                Have fun.

                                                                d.