Why does innerDocWindowRect or any of the other window rects work?

New Here ,
Oct 26, 2018

Copy link to clipboard

Copied

Of the many many many issues with scripting issues there are with writing code in Acrobat, this one I have not found a work around. How  are we supposed to find the inner document window rec when none of the window rec functions work?

Adobe Community Professional
Correct answer by Joel_Geraci | Adobe Community Professional

It's not poor design. That would imply that someone thought about it. In fact, it wasn't designed at all. It was an unintended consequence of delayed plugin loading which lets Acrobat load faster.

If you put the call to initialize the media object at the document level, it'll be ready by the time the user sees the button and well before they can get the mouse over to it to click it.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

205

Likes

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

Why does innerDocWindowRect or any of the other window rects work?

New Here ,
Oct 26, 2018

Copy link to clipboard

Copied

Of the many many many issues with scripting issues there are with writing code in Acrobat, this one I have not found a work around. How  are we supposed to find the inner document window rec when none of the window rec functions work?

Adobe Community Professional
Correct answer by Joel_Geraci | Adobe Community Professional

It's not poor design. That would imply that someone thought about it. In fact, it wasn't designed at all. It was an unintended consequence of delayed plugin loading which lets Acrobat load faster.

If you put the call to initialize the media object at the document level, it'll be ready by the time the user sees the button and well before they can get the mouse over to it to click it.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

206

Likes

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
Oct 26, 2018 0
Adobe Community Professional ,
Oct 26, 2018

Copy link to clipboard

Copied

This one is odd. You have to initialize the media object first. Then innerAppWindowRect and innerDocWindowRect start working. Add the line below to your code above where you need those properties.

var hack = this.media

Likes

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
Reply
Loading...
Oct 26, 2018 0
New Here ,
Oct 26, 2018

Copy link to clipboard

Copied

That did not help. still getting undefined

Likes

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
Reply
Loading...
Oct 26, 2018 0
New Here ,
Oct 26, 2018

Copy link to clipboard

Copied

var hack = this.media;

var myDocRect = this.innerDocWindowRect;

console.clear();

console.show();

console.println(myDocRect);

returns undefined

Likes

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
Reply
Loading...
Oct 26, 2018 0
New Here ,
Oct 26, 2018

Copy link to clipboard

Copied

I have discovered that the function works with javascript on a link that is created manually but NOT on a link created dynamically with javascript

Likes

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
Reply
Loading...
Oct 26, 2018 0
Most Valuable Participant ,
Oct 26, 2018

Copy link to clipboard

Copied

this.media itself also returns null, it seems...

Likes

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
Reply
Loading...
Oct 26, 2018 0
New Here ,
Oct 26, 2018

Copy link to clipboard

Copied

i have found out the both this.media and this.outerDocWindowRect will only work intermittently on links created manually.

Likes

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
Reply
Loading...
Oct 26, 2018 0
Adobe Community Professional ,
Oct 26, 2018

Copy link to clipboard

Copied

It's not intermittent. It takes a few seconds to load the plugin that controls the media object so if you try to get the property immediately after initializing media, it's undefined.

Put this.media into a timerOut, maybe every tenth of a second or so. When it returns an object rather than undefined, you know it's loaded and then you can call the rects.

Likes

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
Reply
Loading...
Oct 26, 2018 0
New Here ,
Oct 26, 2018

Copy link to clipboard

Copied

that is not good at all!!!

very very poor design!!!!

So the user has to wait every time they click a button that requires the rect of the window to be known?

AND why in the hell is that not in the documentation?

Likes

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
Reply
Loading...
Oct 26, 2018 0
Most Valuable Participant ,
Oct 26, 2018

Copy link to clipboard

Copied

That’s ugly, but you could put a load at document level. Still might not have finished by the time you need the functionality but delay likely to reduce.

Likes

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
Reply
Loading...
Oct 26, 2018 0
Adobe Community Professional ,
Oct 26, 2018

Copy link to clipboard

Copied

It's not poor design. That would imply that someone thought about it. In fact, it wasn't designed at all. It was an unintended consequence of delayed plugin loading which lets Acrobat load faster.

If you put the call to initialize the media object at the document level, it'll be ready by the time the user sees the button and well before they can get the mouse over to it to click it.

Likes

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
Reply
Loading...
Oct 26, 2018 1
New Here ,
Nov 08, 2018

Copy link to clipboard

Copied

the poor design is having to load a plug in to find out the rect of the document window.

Further more putting this.media in the document level script does NOT work

Likes

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
Reply
Loading...
Nov 08, 2018 0