12 Replies Latest reply on Sep 20, 2017 6:07 AM by tpk1982

    Need imposition script

    tpk1982 Level 4

      Hi All,

       

      Good Day. I need to make 4 page document into 2 page like below. The width will be twice before moving the page 4 into 1

       

      Source               Final

       

      Screen Shot 2017-09-19 at 4.39.10 PM.png          Screen Shot 2017-09-19 at 4.40.00 PM.png

       

      The below coding Is I wrote for Indesign.

       

      var myDoc=app.documents[0];
      var mywidth=myDoc.documentPreferences.pageWidth;
      var myheight=myDoc.documentPreferences.pageHeight;
      var myX = (myDoc.pages[0].bounds[3] - myDoc.pages[0].bounds[1] );  
      var myY = (myDoc.pages[1].bounds[3] - myDoc.pages[1].bounds[1] );  
      
      
      myDoc.documentPreferences.pageWidth=mywidth*2;
      myDoc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;  
      
      
      app.activeWindow.transformReferencePoint = AnchorPoint.TOP_LEFT_ANCHOR;
      
      
      myDoc.pages[1].pageItems.everyItem().move(myDoc.pages[1], [-myX,0]);  
      myDoc.pages[2].pageItems.everyItem().duplicate(myDoc.pages[1], [0,0]);  
      myDoc.pages[3].pageItems.everyItem().duplicate(myDoc.pages[0], [-myX,0]);  
      myDoc.pages[3].remove();
      myDoc.pages[2].remove();
      

       

       

      I need the same functionality into PDF. I know about Quite Imposing plugin, but our team like to do this in script.

       

      Please give me some suggestion, if anybody have this script then it would be great if you share those.

       

      PS: I found one interesting link... Small imposition script: Where to start?

       

      Thanks,

      K

        • 1. Re: Need imposition script
          try67 MVP & Adobe Community Professional

          The question seems to have been answered in the thread you linked to... Did you try using the code provided there?

          • 2. Re: Need imposition script
            tpk1982 Level 4

            Hi try67,

             

            Yes I tried. It is used for button to give the result. I am very basic in PDF scripting. The overlay concept is useful I think. But not sure how to use that.

             

            Thanks,

            K

            • 3. Re: Need imposition script
              try67 MVP & Adobe Community Professional

              So what are you looking for, exactly? The code is available, more or less. If you wish someone to adjust it to your specific needs and convert it into a script that can be executed using a button, feel free to contact me privately (try6767 at gmail.com) and we could discuss it further.

              • 4. Re: Need imposition script
                tpk1982 Level 4

                Hi try67,

                 

                I dont need any button. Just want to know how to modify the Indesign script into PDF script. What will I need to change.

                 

                Thanks,

                K

                • 5. Re: Need imposition script
                  Karl Heinz Kremer Adobe Community Professional

                  InDesign and Acrobat are using completely different JavaScript implementations. This means that you cannot just port a script from one environment to the other, you will have to start a new script from scratch.

                  1 person found this helpful
                  • 6. Re: Need imposition script
                    tpk1982 Level 4

                    Hi Karl,

                     

                    Thank you for the suggestion. I thought I can use the same logic for PDF script except the keywords in coding. Maybe the object model differs.

                     

                    Regards,

                    K

                    • 7. Re: Need imposition script
                      Karl Heinz Kremer Adobe Community Professional

                      The object model is completely different, there is no overlap. To use the same logic, take the script form the question you linked to originally and build something based on that. It might be cheaper (and a lot easier) to just go with Quite Imposing.

                      • 8. Re: Need imposition script
                        tpk1982 Level 4

                        Hi Karl,

                         

                        Thanks again for your suggestion. Let I try and let you know if I need any assistance.

                         

                        Regards,

                        K

                        • 9. Re: Need imposition script
                          tpk1982 Level 4

                          Hi Karl/try67,

                           

                          Here is my script which approach with watermark concept. This is working fine. Please validate and let me know if this script will cause any error in future.

                           

                          var pt2inch = 72;
                          var rectCrop = this.getPageBox(); 
                          var rotWidth = rectCrop[2]-rectCrop[0];
                          newPage({nWidth: rotWidth * 2}) 
                          newPage({nWidth: rotWidth * 2}) 
                          this.addWatermarkFromFile({ cDIPath: this.path, nSourcePage: 0, nStart:4, nEnd: 4, nHorizAlign: 0, nVertAlign: 0, nHorizValue: pt2inch*8.5, nVertValue: 0, nRotation: 0 });
                          this.addWatermarkFromFile({ cDIPath: this.path, nSourcePage: 3, nStart:4, nEnd: 4, nHorizAlign: 0, nVertAlign: 0, nHorizValue: 0, nVertValue: 0, nRotation: 0 });
                          this.addWatermarkFromFile({ cDIPath: this.path, nSourcePage: 1, nStart:5, nEnd: 5, nHorizAlign: 0, nVertAlign: 0, nHorizValue: pt2inch*8.5, nVertValue: 0, nRotation: 0 });
                          this.addWatermarkFromFile({ cDIPath: this.path, nSourcePage: 2, nStart:5, nEnd: 5, nHorizAlign: 0, nVertAlign: 0, nHorizValue: 0, nVertValue: 0, nRotation: 0 });
                          this.deletePages({nStart: 0, nEnd: 3});
                          

                           

                          Here is the sample file

                           

                          Test 4 page.pdf - Box

                           

                          Thanks,

                          K

                          • 10. Re: Need imposition script
                            try67 MVP & Adobe Community Professional

                            How are we supposed to know if it will cause errors in the future? We're

                            not soothsayers... If in the future it doesn't work, for some reason,

                            you'll need to fix it.

                            • 11. Re: Need imposition script
                              try67 MVP & Adobe Community Professional

                              PS. this script does not produce the output you described in your original post. The last two pages are in reverse order (3-2 instead of 2-3)...

                              1 person found this helpful
                              • 12. Re: Need imposition script
                                tpk1982 Level 4

                                Hi try67,

                                 

                                Thank you for pointing the page reverse order. I am novice in PDF scripting so just asked your kind opinion about the future cause error if anything you see obvious in the code. I know all of us are not soothsayers.

                                 

                                Thanks for your valuable suggestions.

                                 

                                Regards,

                                K