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

how script get dimensions text frame Before Place on Pages?

Community Beginner ,
Feb 05, 2018 Feb 05, 2018

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.

TOPICS
Scripting

Views

2.4K

Translate

Translate

Report

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
Community Expert ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

Moving to InDesign Scripting forum

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

what?

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

Is not it a forum?

Votes

Translate

Translate

Report

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
Community Expert ,
Feb 05, 2018 Feb 05, 2018

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

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 06, 2018 Feb 06, 2018

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.

Votes

Translate

Translate

Report

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
Community Expert ,
Feb 06, 2018 Feb 06, 2018

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

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 06, 2018 Feb 06, 2018

Copy link to clipboard

Copied

how provide dimensions a graphic frame?

Votes

Translate

Translate

Report

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
Community Expert ,
Feb 06, 2018 Feb 06, 2018

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

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 06, 2018 Feb 06, 2018

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

Votes

Translate

Translate

Report

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
Mentor ,
Feb 06, 2018 Feb 06, 2018

Copy link to clipboard

Copied

No. You have to create rectangle any size, then place image, then fit rectangle to contents

Jarek

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 06, 2018 Feb 06, 2018

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.

Votes

Translate

Translate

Report

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
Community Expert ,
Feb 06, 2018 Feb 06, 2018

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

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 06, 2018 Feb 06, 2018

Copy link to clipboard

Copied

LATEST

pleas give me this script code.

pleas!!!!!

Votes

Translate

Translate

Report

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
Community Expert ,
Feb 05, 2018 Feb 05, 2018

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

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 06, 2018 Feb 06, 2018

Copy link to clipboard

Copied

Please give me more guidance.

Votes

Translate

Translate

Report

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
Community Beginner ,
Feb 06, 2018 Feb 06, 2018

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

Votes

Translate

Translate

Report

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