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

Wrong frame size, Indd CS6 and CC, js

Participant ,
Jul 25, 2017 Jul 25, 2017

Copy link to clipboard

Copied

Hi,

Recently I started to have unusual problem: frames are not displayed in the size they are set in geometric Bounds. One page would do it correctly another would stretch the frame. One computer would do it correctly another would stretch. Any idea what is going on and how I can make it work:

myTextBkg = myDoc.pages[0].rectangles.add (myDoc.layers.item ("Template"));

myTextBkg.geometricBounds = [myY-.05045, myX-.4102, myY+0.05045, myX+0.4102];

If myY = 1 in, and myX = 1 in,  I should have:

myTextBkg.geometricBounds = [1-.05045, 1-.4102, 1+0.05045, 1+0.4102];

myTextBkg.geometricBounds = [0.94955, 0.5898, 1.05045, 1.4102];

This:

Screen Shot 2017-07-25 at 12.18.59 PM.png

Instead of this:

Screen Shot 2017-07-25 at 12.17.19 PM.png

Thank you for your help.

Yulia

TOPICS
Scripting

Views

376

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
People's Champ ,
Jul 25, 2017 Jul 25, 2017

Copy link to clipboard

Copied

Are you sure all users are using the same units ?

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
Participant ,
Jul 25, 2017 Jul 25, 2017

Copy link to clipboard

Copied

Yes,

and would it use different units for width to height? It's showing 3 sides correctly. And it only extends to the right in all cases.

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
Participant ,
Jul 25, 2017 Jul 25, 2017

Copy link to clipboard

Copied

Actually I just tried 2nd width value with variable only:

myTextBkg.geometricBounds = [myY-.05045, myX-.4102, myY+0.05045, myX+0.4102]; 

and it worked correctly. It looks like when I add 0.4102 to it, it adds few inches instead of 0.4102, like it's deducting it from document width.

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
Participant ,
Jul 25, 2017 Jul 25, 2017

Copy link to clipboard

Copied

I just tried it with +0 and it added same few extra inches to it:

myTextBkg.geometricBounds = [myY-.05045, myX-.4102, myY+0.05045, myX+0]; 

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
Participant ,
Jul 25, 2017 Jul 25, 2017

Copy link to clipboard

Copied

and I reassigned inches to document preferences:

myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.inches;

myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.inches;

Still same thing.

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
Participant ,
Jul 25, 2017 Jul 25, 2017

Copy link to clipboard

Copied

I figured it out. The value for myX variable comes from dialog box, and it must be occasionally does not recognize it as numeric value, so it just guessing a number.

I added this to it:

myX = eval (myX);

And it's now working.

Yulia

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
People's Champ ,
Jul 26, 2017 Jul 26, 2017

Copy link to clipboard

Copied

LATEST

I was suspecting something like that but it was hard to assume without details

FWIW, you can easily convert strings to numbers without eval:

var myString = "1";

var myNum = Number( myString );

or

var myNum = parseFloat ( myString );

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