1 Reply Latest reply on Feb 4, 2016 7:34 AM by CarlosCanto

    Can you write extendscript code to export selected area within document into image

    dnyaneshlb Level 1

      Hi,

       

      I don't know if this functionality already exist.

      I have a extension panel. I want to select some objects/items in document and when I click on "Export to Image" button on panel, the selected area should get exported to image.

       

      I have tried extendscript API on document object.

      var  file = new File("/d/innovate/iconRollover.png");
      var  selection = app.activeDocument.selection[0];
      if(selection != null && selection != undefined)
      {
             app.activeDocument.imageCapture(file, app.activeDocument.cropbox);
          //app.activeDocument.imageCapture(file, selection.geometricBounds);
      }
      

       

      This script works fine if you select single object(groupItem/PathItem). Buit when you select more than two items, it doesn't work.

      It is supposed to capture all the selected area in document and export it as png.

       

      Let me know if you need more information.