Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi,
Use fit options content to frame.
Copy link to clipboard
Copied
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).");
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now