18 Replies Latest reply on Mar 18, 2014 9:40 AM by Jump_Over

    Place Indesign files from Book File into 1 document

    Eugene Tyson Adobe Community Professional & MVP

      I have an Indesign book, but I need to do some pagination on it for inhouse proofing.

       

      However, the Print Booklet feature doesn't work with Book Files.

       

      Is it possible to place all the files in the right order as they appear in the Book FIle into a single document?

        • 2. Re: Place Indesign files from Book File into 1 document
          Eugene Tyson Adobe Community Professional & MVP

          Hi Obi

           

          Thanks for that - it's not what I am looking for though.

           

          It's more like this

          http://indesignsecrets.com/zanelli-releases-multipageimporter-for-importing-both-pdf-and-i ndd-files.php

           

          But to work on an InDesign Book.

          • 3. Re: Place Indesign files from Book File into 1 document
            Obi-wan Kenobi Adobe Community Professional

            Eugene,

             

            There's a script written by Dave Saunders that merges 2 ID files in one. Perhaps for what you want to do.

            • 4. Re: Place Indesign files from Book File into 1 document
              Eugene Tyson Adobe Community Professional & MVP

              I've tried that but I want the script to work with the order they are in in the book file.

               

              I need all these files as they appear in the order in the Book Panel

               

              Capture.PNG

               

              To be Placed as InDesign files into a new document

              • 5. Re: Place Indesign files from Book File into 1 document
                Obi-wan Kenobi Adobe Community Professional

                If no other solution, you can merge:

                 

                3 and 4-6 = 3-6

                3-6 and 7 = 3-7

                3-7 and 8-9 = 3-9

                ...

                • 6. Re: Place Indesign files from Book File into 1 document
                  Eugene Tyson Adobe Community Professional & MVP

                  Nope - I don't want to merge them.

                   

                  I need to place them all in one file.

                   

                  That means I can edit the pages using the Edit Original command and go back to the layout.

                  • 8. Re: Place Indesign files from Book File into 1 document
                    Jump_Over Level 5

                    Hi,

                     

                    Maybe this could be usefull:

                    var 
                        mBook = app.books[0],
                        mFile = File(mBook.filePath + "/summary.indd"),
                        mCont = mBook.bookContents.everyItem().getElements(),
                        k, mTarget, currDoc;
                    
                    mCont.sort(sortBook);
                    
                    for (k = 0; k < mCont.length; k++) {
                        currDoc = app.open(mCont[k].fullName, false);
                        if (!k) {
                            mTarget = currDoc.saveACopy (mFile);
                            currDoc.close();
                            mTarget = app.open(mFile);
                            }
                        else {
                            currDoc.pages.everyItem().duplicate(LocationOptions.AFTER, mTarget.pages[-1]);
                            currDoc.close();
                            }
                        }
                    
                    function sortBook(a,b) {
                        return parseInt(a.documentPageRange) >= parseInt(b.documentPageRange);
                        }
                    

                     

                    Should work with with last opened book; booksContents linked (updated).

                    Output is summary.indd located in this book folder

                     

                    Jarek

                    • 9. Re: Place Indesign files from Book File into 1 document
                      Eugene Tyson Adobe Community Professional & MVP

                      Hi

                       

                      Thanks for that -

                       

                      Unfortunately with InDesign CS5.5 on Windows 7  - it crashes.

                       

                      When I reopen it InDesign it recovers the Summary.Indd file but with only the first document.

                      • 10. Re: Place Indesign files from Book File into 1 document
                        Jump_Over Level 5

                        Hi,

                         

                        Can be hard to detect..., hm...

                        All this synchronization options, styles, masterSpreads... is it a reason why book structure is better than merged doc...?

                         

                        Playing with k value (for k=a; k<b;k++) can help to find parts with problems, but...

                        did you consider to export whole book as PDF and reach Print Booklet feature with this  source?

                         

                        Jarek

                        • 11. Re: Place Indesign files from Book File into 1 document
                          Eugene Tyson Adobe Community Professional & MVP

                          Currently I am using export to PDF.


                          Then I batch import the PDF into InDesign using the MultiPage importer.

                           

                          But if a page changes I have to re-PDF and update all the links in the PDF - which is a bit time consuming.

                           

                           

                          It would be a lot faster if I could batch import each file individually into a new file via the File>Place command

                           

                          Recognise first document in book

                          Add in appropriate number of pages

                          Place all pages in the right order

                           

                          repeat for each document in book adding pages to the end each time.

                          • 12. Re: Place Indesign files from Book File into 1 document
                            Jump_Over Level 5

                            Hi,

                             

                            What about placing InDesign pages instead of PDFs in this summary.indd?

                            I mean importedPages which are linked to original docs.

                            If some of them change contents ==> update links fix it, thats all.

                             

                            So script could create a doc with placed (not duplicated) pages (as importedPages) in proper order read from a book structure...

                             

                            Jarek

                            • 13. Re: Place Indesign files from Book File into 1 document
                              Eugene Tyson Adobe Community Professional & MVP

                              Hi

                               

                              Thanks for the help so far.

                               

                              I'm not sure if it was unclear.

                               

                               

                              But I want the script to place Indesign files into a layout - much like the MultiPage Importerd does - but with Indesign files.

                               

                              And I would like the script to use the Book File to fetch the documents in the correct order.

                               

                              And place each document consecutively into a single document.

                               

                               

                              That is it uses

                               

                              File Place> and selects the QuickFind document (first document in book list) and places that into the page as an InDD linked file.

                               

                              It then fetches the next Document, called "Digest" in this instance - and again places an indd file (as a link) into the document directly after the QuickFind page.

                               

                               

                              In essence it would place each file into a document in the correct order, and what I am left with is a complete book from page 1 to end.

                               

                              Everything that is placed should be an ".indd" file and in the correct order.

                               

                               

                              Is this possible?

                              • 14. Re: Place Indesign files from Book File into 1 document
                                Jump_Over Level 5

                                Hi,

                                 

                                quick version just to check:

                                var 
                                    mBook = app.books[0],
                                    mFile = new File(mBook.filePath + "/summary.indd"),
                                    mCont = mBook.bookContents.everyItem().getElements(),
                                    mTarget = app.documents.add().save(mFile),
                                    k, i, currDoc, currDocSize, currPage, currBox;
                                    mTarget = app.open(mFile);
                                    if (mTarget.pageItems.length > 0)
                                        clear (mTarget);
                                mCont.sort(sortBook);
                                
                                for (k = 0; k < mCont.length; k++) {
                                    currDoc = app.open(mCont[k].fullName, false);
                                    currDocSize = currDoc.pages.length;
                                    for (i = 0 ; i < currDocSize; i++) {
                                        app.importedPageAttributes.pageNumber = i + 1;
                                        currPage = currDoc.pages[i];
                                        currBox = mTarget.pages[-1].rectangles.add({geometricBounds: checkPage (currPage, mTarget.pages[-1]) });
                                        currBox.place(File(mCont[k].fullName, false))
                                        mTarget.pages.add();
                                        }
                                    currDoc.close();
                                    }
                                    mTarget.pages[-1].remove();
                                    mTarget.save();
                                
                                function sortBook(a,b) {
                                    return parseInt(a.documentPageRange) >= parseInt(b.documentPageRange);
                                    }
                                function clear (doc) {
                                    doc.pages.itemByRange(1,-1).remove();
                                    doc.pageItems.everyItem().remove();
                                    doc.save();
                                    }
                                function checkPage (source, target) {
                                    var 
                                        sGB = source.bounds,
                                        sW = sGB[3] - sGB[1],
                                        sH = sGB[2] - sGB[0],
                                        tGB = target.bounds,
                                        tW = tGB[3] - tGB[1],
                                        tH = tGB[2] - tGB[0];
                                        if (sW != tW || sH != tH)
                                        target.resize(
                                            CoordinateSpaces.INNER_COORDINATES,
                                            AnchorPoint.TOP_LEFT_ANCHOR,
                                            ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
                                            [sW, sH] );
                                        return target.bounds;
                                    }
                                

                                Jarek

                                • 15. Re: Place Indesign files from Book File into 1 document
                                  Eugene Tyson Adobe Community Professional & MVP

                                  Thanks - that definitely placed all the files.

                                   

                                  My document size is 192 (w) x 250 (h) mm

                                   

                                  The script created a 210 x 297 mm size document

                                  but all the pages in the resulting file have a size of 67.733 mm x 88.194mm - I can see this by using the page tool.

                                   

                                   

                                  All the files are placed in the right order - so that's very good.

                                   

                                   

                                  need to sort out the page size though

                                   

                                  any idea?

                                  • 16. Re: Place Indesign files from Book File into 1 document
                                    Jump_Over Level 5

                                    Hi,

                                     

                                    It looks like mess of units (points - mm).

                                    Insert 1st line into the function checkPage:

                                    target.parent.parent.viewPreferences.horizontalMeasurementUnits = 
                                         source.parent.parent.viewPreferences.horizontalMeasurementUnits = 
                                         target.parent.parent.viewPreferences.verticalMeasurementUnits = 
                                         source.parent.parent.viewPreferences.verticalMeasurementUnits = MeasurementUnits.POINTS;
                                    

                                     

                                    Jarek

                                     

                                    PS. It can be better to change a line 22 as well:

                                    currDoc.close(SaveOptions.NO);
                                    

                                     

                                    Message was edited by: Jump_Over changed it to equal unit (POINTS)

                                    • 17. Re: Place Indesign files from Book File into 1 document
                                      Eugene Tyson Adobe Community Professional & MVP

                                      Thanks again for all the help so far.

                                       

                                      However, I'm not 100% sure what I'm supposed to do here - can you elaborate on what the steps are I have to do?

                                      • 18. Re: Place Indesign files from Book File into 1 document
                                        Jump_Over Level 5

                                        Hi,

                                         

                                        Here is a modified version:

                                        #target indesign
                                        
                                        var 
                                            mBook = app.books[0],
                                            mFile = new File(mBook.filePath + "/summary.indd"),
                                            mCont = mBook.bookContents.everyItem().getElements(),
                                            mTarget = app.documents.add().save(mFile),
                                            k, i, currDoc, currDocSize, currPage, currBox;
                                            mTarget = app.open(mFile);
                                            if (mTarget.pageItems.length > 0)
                                                clear (mTarget);
                                        
                                             mCont.sort(sortBook);
                                        
                                        for (k = 0; k < mCont.length; k++) {
                                            currDoc = app.open(mCont[k].fullName, false);
                                            currDocSize = currDoc.pages.length;
                                            for (i = 0 ; i < currDocSize; i++) {
                                                app.importedPageAttributes.pageNumber = i + 1;
                                                currPage = currDoc.pages[i];
                                                currBox = mTarget.pages[-1].rectangles.add({geometricBounds: checkPage (currPage, mTarget.pages[-1]) });
                                                currBox.place(File(mCont[k].fullName, false))
                                                mTarget.pages.add();
                                                }
                                             currDoc.close(SaveOptions.NO);
                                            }
                                            mTarget.pages[-1].remove();
                                            mTarget.save();
                                        
                                        function sortBook(a,b) {
                                            return parseInt(a.documentPageRange) >= parseInt(b.documentPageRange);
                                            }
                                        function clear (doc) {
                                            doc.pages.itemByRange(1,-1).remove();
                                            doc.pageItems.everyItem().remove();
                                            doc.save();
                                            }
                                        function checkPage (source, target) {
                                             target.parent.parent.viewPreferences.horizontalMeasurementUnits = 
                                             source.parent.parent.viewPreferences.horizontalMeasurementUnits = 
                                             target.parent.parent.viewPreferences.verticalMeasurementUnits = 
                                             source.parent.parent.viewPreferences.verticalMeasurementUnits = 
                                                  MeasurementUnits.POINTS;
                                            var 
                                                sGB = source.bounds,
                                                sW = sGB[3] - sGB[1],
                                                sH = sGB[2] - sGB[0],
                                                tGB = target.bounds,
                                                tW = tGB[3] - tGB[1],
                                                tH = tGB[2] - tGB[0];
                                        
                                                if (sW != tW || sH != tH)
                                                target.resize(
                                                    CoordinateSpaces.INNER_COORDINATES,
                                                    AnchorPoint.TOP_LEFT_ANCHOR,
                                                    ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
                                                    [sW, sH] );
                                        
                                                return target.bounds;
                                            }
                                        

                                         

                                        Jarek