Skip to main content
Inspiring
Jun 4, 2017 7:55 AM UTC
Answered

Query screen DPI scaling in JavaScript

Is there a way, with JavaScript in Acrobat, to find the DPI scaling settings of the current display?

I'm talking about the "Change the size of text, apps and other items" settings in Windows:

Setting this to more than 100% has adverse effects on the text displayed in dialogues I create using app.execDialog().

This topic is closed to new replies. Start a new post to keep the conversation going.
ZoPaarsCorrect answer
Inspiring
Jun 10, 2017 12:16 PM UTC

This might be useful for dialogues that only have single-line text boxes, but anything else will be a bit of a problem. I have a lot of dialogues with multiple lines of text. When you don't add width or height to the dialogue, the text is all displayed on a single line and your dialogue ends up being very, very wide.

Luckily I found a solution for this. There is an undocumented attribute 'wrap_name'. When that is set to 'true' a multiline text field resizes to the correct height automatically, even when the DPI setting changes.

6 replies

Joel Geraci
Community Expert
Community Expert
Jun 5, 2017 9:57 PM UTC

My best advice is to never use width or heigh except for multi-line text areas. The dialog should then resize to what it needs in order to display properly.

Translate
ZoPaarsAuthorCorrect answer
Inspiring
Jun 10, 2017 12:16 PM UTC

This might be useful for dialogues that only have single-line text boxes, but anything else will be a bit of a problem. I have a lot of dialogues with multiple lines of text. When you don't add width or height to the dialogue, the text is all displayed on a single line and your dialogue ends up being very, very wide.

Luckily I found a solution for this. There is an undocumented attribute 'wrap_name'. When that is set to 'true' a multiline text field resizes to the correct height automatically, even when the DPI setting changes.

Translate
Inspiring
Jun 4, 2017 2:20 PM UTC
ZoPaarsAuthor
Inspiring
Jun 5, 2017 8:55 PM UTC

Thank you for your response.

I found the Monitors object in the Acrobat SDK but it unfortunately doesn't have what I'm looking for. Guess it is not possible then...

Translate
Inspiring
Jun 5, 2017 9:37 PM UTC

Using the Acrobat SDK you might be able to create a plug-in to access that system information and pass it back to Acrobat/Reader. If your users need this then they will have manually install the plug-in on their system.

JavaScript is very limited on what OS information and actions it can access for security reasons.

Translate
try67
Community Expert
Community Expert
Jun 4, 2017 8:50 AM UTC

I don't think so, but look at the properties of the Monitors and Monitor objects and see if you find something similar to what you're after...

Translate