1 Reply Latest reply on Jan 12, 2011 12:16 AM by Kasyan Servetsky

    How to script for resize CS3 indesign

    Doomster12686

      Hi there,

      I've been trying to search the internet for a script that I can use in the following situation.


      I already use this script to center the content:

      myObj = app.selection[0];
      myObj.fit(FitOptions.centerContent);

       

      the next step I would like to do...after inserting a pdf file within a rectangle frame (that being the "image box"). I would like to, after using the above script, resize the contents of the rectangle frame to whatever percentage for both X and Y (scale X Percentage, as well as Y, both different values).

       

      Any help would be much appreciated. Also, the indd files are all named different, as well as the pdf's being inserted.

        • 1. Re: How to script for resize CS3 indesign
          Kasyan Servetsky Level 5

          Here's a very basic sample script to get you started:

          if (app.documents.length == 0) exit();
          if (app.selection.length == 0) exit();
          var sel = app.selection[0];
          if (sel.constructor.name != "Rectangle") exit();
          var pdfFile = File.openDialog("Choose a PDF File");
          if (pdfFile == null) exit();
          app.pdfPlacePreferences.pdfCrop = PDFCrop.cropMedia; // General > Options > Crop to
          var pdfPage = sel.place(File(pdfFile))[0];
          with (pdfPage) {
               absoluteHorizontalScale = 40; // Horizontal Scale 
               absoluteVerticalScale = 60; // Vertical Scale
          }
          sel.fit(FitOptions.centerContent);
          

           

          It inserts the 1st page of the selected PDF file. If you want to insert specific pages, use app.pdfPlacePreferences.pageNumber property.

           

          Kasyan