Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Scaling the graphic to fit the text frame

Community Beginner ,
Mar 29, 2019 Mar 29, 2019

Hi,

I'm a beginner of Javascript. I have imported the word document into InDesign using Javascript.

But, somehow graphics/images are not fit in the content frame. Below is my coding. It will not be working fine.

//Add a page, create another text frame on it

        var myNewPage = myDoc.pages.add();

        var myTextFrameE = myNewPage.textFrames.add();

        myTextFrameE.geometricBounds = [738, 54, 54, 558];

       

        //Add a page, create another text frame on it

        var myNewPage = myDoc.pages.add();

        var myTextFrameF = myNewPage.textFrames.add();

        myTextFrameF.geometricBounds = [738, 54, 54, 558];

       

        myTextFrameE.nextTextFrame = myTextFrameF;

       

        myTextFrameE.place(myWordDocuments);

                       

        //img.fit(FitOptions.FRAME_TO_CONTENT)

        //img.fit(FitOptions.FRAME_TO_CONTENT)

        //img.fit(FitOptions.FRAME_TO_CONTENT)

        //img.fit(FitOptions.FRAME_TO_CONTENT)

        //img.fit(FitOptions.FRAME_TO_CONTENT)

        //img.fit(FitOptions.FRAME_TO_CONTENT)

Please help on this.

Regards,

KPS

TOPICS
Scripting
490
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 29, 2019 Mar 29, 2019

Hi,

     Use fit options content to frame.

     FitOptions.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 09, 2019 Aug 09, 2019
LATEST

I used this code to resize the images to fit proportionally in it's frame.

fitImagesToFrame(); 

 

function fitImagesToFrame(){ 

    var allLinks = app.activeDocument.links; 

    for(var i=0;i<allLinks.length;i++){ 

           var myImage = app.activeDocument.links.parent;

           myImage.fit(FitOptions.FILL_PROPORTIONALLY);  // fill frame proportionally

           //myImage.fit(FitOptions.PROPORTIONALLY); // fit frame proportionally

    }

    alert("Images have been fitted (Fill Proportionally).");

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines