2 Replies Latest reply on Jan 25, 2016 9:17 PM by milligramme

    Is there a way to make a jsx script work even though images are invisible ('overset text')?

    Pelter Level 1

      We have made a script that runs after import of xml in InDesign, which addresses images in xml that are too big to handle (for example 4000px). It adds an object style to the images and makes the images fit the width of a text frame, so it easier to handle.


      Never the less it is impossible to make the script work, when images that are hidden Is there a way to make the script work even though images are in 'overset text'?

       

      J.

        • 1. Re: Is there a way to make a jsx script work even though images are invisible ('overset text')?
          Vamitul Level 4

          Kind of hard to give you an answer without seeing some code and some more details. Why is it "impossible"?

          • 2. Re: Is there a way to make a jsx script work even though images are invisible ('overset text')?
            milligramme Level 3

            Hi

            this is a sample code to modify overset graphicframe by using huge temporary textframe;

             

             

             

            // document has a textframe and its story has a overset graphicframe with large image
            var doc      = app.documents[0];
            var stry     = doc.stories[0];
            var imgframe = stry.pageItems[0];
            
            
            
            
            var insert_point = imgframe.parent;
            var insert_point_idx = insert_point.index;
            
            
            // create temporary textframe to rescue the graphicframe
            var huge_textframe = doc.textFrames.add({geometricBounds:[0,0,4000,8000]});
            
            
            // duplicate the insertpoint with the graphicframe to temporary textframe
            var dup_insert_point = insert_point.duplicate(LocationOptions.AT_BEGINNING, huge_textframe.parentStory);
            
            
            // resize the graphicframe
            var dup_imgframe = dup_insert_point.pageItems[0];
            dup_imgframe.geometricBounds = [0,0,300,400];
            dup_imgframe.fit(FitOptions.CONTENT_TO_FRAME);
            
            
            // restore the modified graphicframe to the end of original textframe story
            var mod_insert_point = dup_insert_point.duplicate(LocationOptions.AT_END, insert_point.parent);
            // move to original position
            mod_insert_point.move(LocationOptions.BEFORE, insert_point.parent.characters[insert_point_idx])
            
            
            // remove temporary textframe and overset graphicframe
            stry.characters.itemByRange(insert_point_idx+1,insert_point_idx+1).remove();
            huge_textframe.remove();
            

             

            thank you

            mg.