2 Replies Latest reply on Nov 8, 2010 8:48 AM by lhanneman

    Javascript - added images display as grey boxes

    m.p.programmer

      I am attempting to add an Image to an InDesign document via a javascript that I am executing via the RunScript() soap method of InDesign Cs4 server.  The script I am using to add an image is something similar to this:

       

      var imageFile = File("//c/images/animage.pdf");
      var imageGraphic = myDocument.pages.item(0).place(imageFile, null, imageLayer);
      imageGraphic = imageGraphic[0];
      var imageFrame = imageGraphic.parent;
      imageFrame.geometricBounds = [IMAGE_TOP_Y, IMAGE_TOP_X, IMAGE_BOTTOM_Y, IMAGE_BOTTOM_X];
      imageFrame.fit(FitOptions.proportionally);
      imageFrame.fit(FitOptions.frameToContent);

       

      The script adds the image correctly, but when I pull up the document with InDesign, the Images are displayed as grey boxes.  I am able to fix this within InDesign designer by manually setting the "Display Performance" to "High Quality" through the menus, but I need to handle this via the script run on the server.  I attempted to update the script to the following:

       

      var imageFile = File("//c/images/animage.pdf");
      var imageGraphic = myDocument.pages.item(0).place(imageFile, null, imageLayer);
      imageGraphic = imageGraphic[0];
      var imageFrame = imageGraphic.parent;
      imageFrame.geometricBounds = [IMAGE_TOP_Y, IMAGE_TOP_X, IMAGE_BOTTOM_Y, IMAGE_BOTTOM_X];
      imageFrame.fit(FitOptions.proportionally);
      imageFrame.fit(FitOptions.frameToContent);

       

      //HERE IS THE NEW LINE
      imageFrame.localDisplaySetting = DisplaySettingOptions.HIGH_QUALITY;

       

      This script runs without problems within the CS4 ExtendScript Toolkit on my local pc.  However, when I run the script against the InDesign CS4 server, I get the following error:

       

      Error Number: 55
      Error String: Object does not support the property or method 'localDisplaySetting'

       

      Does anyone have any advice on how I should proceed?  My main goal is to have the image display correctly without the grey box.

        • 1. Re: Javascript - added images display as grey boxes
          m.p.programmer Level 1

          I've figured this out. I started InDesign Server CS4 via the command line, and noticed a line on the console during the startup specifying that image previews were turned off.  It turns out there is a command line option "-[no]previews" that allows you to turn image previews off and on.  This option is set by default to "-nopreviews".

           

          So the solution is to add "-previews" to the command line arguments on either your command line invocation, or via the InDesign Service settings (if you are running this as a service).

          • 2. Re: Javascript - added images display as grey boxes
            lhanneman

            hello, I'm running into the same issue with image showing up as grey boxes. I'm updating documents via (JS) scripts by placing new images into rectangles. When I open up that document after the script saves it, all I see is a grey box until I change the Display Performance to Typical (or higher). In my scripts, I can change the localDisplaySettings to DisplaySettings.TYPICAL, but it only works locally, when I run this on the server it fails because it says DisplaySettings is undefined. I'm wondering if this is a server setting, and if so, how I might be able to change it?

             

            Thanks in advance!