1 Reply Latest reply on May 12, 2008 1:52 PM by (B_Hensley)

    Script to crop

      I have a javascript that I use in a batch process and I need to add a "crop". I am not sure what the best way is to have this done but I need to convert my 8.5x5.5 document to an 11x8.5 document. After the page size is expanded I add a background to fill in the rest of the space.

      The image doesn't to be expanded just the page size so I can add my background.

      Using Acro Pro 7

      Thanks
        • 1. Re: Script to crop
          Level 1
          I'm not sure how to add JavaScript to a batch process, but here's some code we use to increase the bottom and right margins. A couple of small tweaks should adapt it to include the top and left margins.

          We increase both the Media box and Crop box. I'm not sure what makes sense in your case.

          Bruce

          //-----

          function increaseMargins(p,box,marginIncrease)
          //increase margins for a specified box (e.g. Media, Crop)
          {
          var rect = this.getPageBox(box,p);
          var newRect = new Array();
          newRect[0] = rect[0];
          newRect[1] = rect[1];
          newRect[2] = rect[2] + (marginIncrease);
          newRect[3] = rect[3] - (marginIncrease);
          this.setPageBoxes(box,p,p,newRect);
          }

          var marginIncrease = 0.25 * 72; // quarter inch increase
          var firstPage = 1;
          var lastPage = this.numPages;

          for (var p = firstPage; p < lastPage; p++)
          {
          increaseMargins(p,"Media",marginIncrease);
          var mediaRect = this.getPageBox("Media",p);
          this.setPageBoxes("Crop",p,p,mediaRect);
          };