2 Replies Latest reply on May 22, 2013 7:34 AM by Rynnlynn

    Relink script for print imposition

    Rynnlynn

      Hello. Hopefully someone can give me some tips on this. I know I can't be the first person to tackle this issue.

       

      I am trying to do a multi-up layout of a pdf in indesign. I have a 45pg pdf, and I need each page in the file 25 times up on its own indesign page. So basically, I need a script that will duplicate the indesign page then relink all of the links on that page to the next page in the pdf file. (sort of like a data merge except from a pdf) This is something that I need to do on a regular basis, so it would be nice to expedite it. Is this even possible?

       

      Many thanks!

        • 1. Re: Relink script for print imposition
          Jump_Over Level 5

          Hi,

           

          Try this:

          var mDoc = app.activeDocument;
          var stop = 2;
          var mPDF, oldPageNum, currPDF, currFile, mRec;
          
          while (stop > 1) {
              stop = 1;
              var mPage = mDoc.pages[-1].duplicate();
              var mGraphics = mPage.allGraphics;
              for (var i = 0; i < mGraphics.length; i ++) {
                  mPDF = mGraphics[i].parent.pdfs[0];
                  if (mPDF.isValid && mPDF.itemLink.status == LinkStatus.NORMAL) {
                      oldPageNum = mPDF.pdfAttributes.pageNumber;
                      app.pdfPlacePreferences.pageNumber = oldPageNum + 1;
                      currFile = mPDF.itemLink.filePath;
                      mRec = mPDF.parent;
                      mRec.place(File(currFile) );
                      stop = mRec.pdfs[0].pdfAttributes.pageNumber;
                      }
                  }
          }
          mPage.remove();
          

          Script will duplicate last doc page and relink all pdf on a new page and increase imported page number.

          This will continue till last pdf page.

          If current page number (to import) is bigger then pdf's pages count ==> script place the first page, thats why a while loop stops

           

          hopefully

          Jarek

          • 2. Re: Relink script for print imposition
            Rynnlynn Level 1

            Worked perfectly! Thank you so much!