Copy link to clipboard
Copied
how get dimensions text frames Before Place on Pages? I think I should use the this function: BEFORE_PLACE().
script indesign.
Please guide me.
Copy link to clipboard
Copied
Moving to InDesign Scripting forum
Copy link to clipboard
Copied
what?
Copy link to clipboard
Copied
Is not it a forum?
Copy link to clipboard
Copied
Hi shahriara7551080 ,
what exactly will you place? And how?
Example 1:
A text frame of a story in the placeGun has no dimensions if you import a text file:
So you cannot read out any dimensions with e.g.:
app.documents[0].placeGuns.pageItems[0].getElements()[0].geometricBounds
I think, the code above will throw an error.
Example 2:
But if you load a snippet idms file is to the placeGun you'll get a reasonable result in return:
app.documents[0].placeGuns.snippets[0].textFrames[0].geometricBounds
Example 3:
If you directly place a text file to a page you can control width and height of the placed frame while placing.
For that you are using argument placePoint. If the placePoint is in between any page margins, the margins will dictate width and height of the resulting text frame.
Regards,
Uwe
Copy link to clipboard
Copied
I have some image with different dimensions.
i want get dimensions then arrenge image in page indesign.
So I need to put it before the pageØŒI have the dimensions of each of the image.
pleas help me.
Copy link to clipboard
Copied
Then provide a graphic frame in advance with a pre-defined size and place the image into that rectangle.
You could set frameFittingOptions.fittingOnEmptyFrame in advance. After placing you could do e.g.:
rectangle.fit( FitOptions.FRAME_TO_CONTENT )
See DOM documentation compiled by Gregor Fellenz for e.g. InDesign CC 2018 here:
https://www.indesignjs.de/extendscriptAPI/indesign13/#about.html
Regards,
Uwe
Copy link to clipboard
Copied
how provide dimensions a graphic frame?
Copy link to clipboard
Copied
shahriara7551080 wrote
how provide dimensions a graphic frame?
You use the add() method of object rectangle and provide geometricBounds plus some other parameters like fillColor and strokeColor and strokeWeight. just an example:
var rectangle = app.documents[0].spreads[0].rectangles.add
(
{
geometricBounds : [ "10mm", "20mm" , "110mm" , "200mm" ] , // y1,x1,y2,x2 ( Width: 180 mm, Height: 100 mm )
fillColor : "None" ,
strokeColor : "None" ,
strokeWeight : 0
}
);
( This is very basic stuff. )
Also consider the value for rulerOrigin with the viewPreferences of the document.
And you'd reset the value for zeroPoint of the document to a "normalized" value of [0,0] perhaps.
Regards,
Uwe
Copy link to clipboard
Copied
no.I have to create this rectangle with the dimensions of the image.
how get dimensions image?
then create rectangle , then fit to rectangle
Copy link to clipboard
Copied
No. You have to create rectangle any size, then place image, then fit rectangle to contents
Jarek
Copy link to clipboard
Copied
I do not want the dimensions of the image to change.
How before you have the dimensions of the image you create rectangel with dimensions rectangle?
pleas give me script this work.
Copy link to clipboard
Copied
When placed, you can scale the image any time to 100%.
That will reflect the dimensions you'd see with an event listener.
Regards,
Uwe
Copy link to clipboard
Copied
pleas give me this script code.
pleas!!!!!
Copy link to clipboard
Copied
shahriara7551080 wrote
… I think I should use the this function: BEFORE_PLACE().
BEFORE_PLACE is not a function.
You could add an event listener to the document that is watching for an AFTER_PLACE event and exploit:
event.target.geometricBounds
or:
event.target.visibleBounds
Search the forum to see some code how the listener is added to a document.
Regards,
Uwe
Copy link to clipboard
Copied
Please give me more guidance.
Copy link to clipboard
Copied
no.I have to create this rectangle with the dimensions of the image.
how get dimensions image?
then create rectangle T then fit to rectangle