0 Replies Latest reply on Jun 2, 2013 11:19 PM by HeulwenM

    How to change/crop to larger page size?

    HeulwenM Level 1

      Hi,

       

      I have the following script to loop through each page in a document, check if each page is A4 Portrait size, and if it is, change it to US Letter paper size:

       

      //Change Portrait A4 Page Size to US Letter Size

      //Values are in points and there are 72 points per inch

      //Check if page is Portrait A4 size (if Yes, then crop to US Letter otherwise ignore)

       

      for (var i=0; i<this.numPages;i++){

      var rCrop = this.getPageBox("Crop",i);

       

      if (this.getPageBox("Crop",i)[1]<842 && getPageBox("Crop",i)[1]>841 && getPageBox("Crop",i)[2]<596 &&

       

      getPageBox("Crop",i)[2]>595){

      rCrop[0] -= 8.28; // Adjust Left Side

      rCrop[1] -= 24.84; // Adjust Top Side

      rCrop[2] += 8.28; // Adjust Right Side

      rCrop[3] += 24.84; // Adjust Bottom Side

       

      this.setPageBoxes("Crop",i,i,rCrop);

      };

      }

       

      The script crops the top and bottom of each page correctly, but only expands the width of the left and right sides on the first page. After doing some experiments it seems the script will crop pages to a smaller size but struggles to expand pages to a larger size (in converting from A4 to US Letter I need to crop top and bottom to smaller size, but expand left and right sides to larger size). I tried changing "Crop" to "Media" but this didn't help.

       

      Any ideas?

       

      Many thanks. HJ