Skip to main content
Known Participant
February 22, 2019
Answered

Can’t get ‘thermometer’ to display when using adobe reader DC.

  • February 22, 2019
  • 2 replies
  • 783 views

Can’t get ‘thermometer’ to display when using adobe reader DC. It does display when using Adobe professional version.

Below is sample code I’m using.

           var t = app.thermometer;

           t.duration = doc.numPages;      

           t.begin();

           

           for (p=0; p<doc.numPages; p++)

                 {

                 t.text = "Searching … page " + p + "/" + doc.numPages;

                  }

           t.end();

This topic has been closed for replies.
Correct answer Thom Parker

Do you know that this code is error free? Is anything displayed in the console window?

The thermometer object is problematic in a couple of ways. First, your code doesn't increase the increment. This is a small point, but the increment is a redraw prompt for the thermometer.  And redrawing is the second problem. The thermometer updates/redraws on free cpu cycles.  Unfortunately the JavaScript engine does not allow for many of these, it's a bit of a hog. If your code is too tight the thermometer may never be drawn, or even it it is shown initially it might not update as expected.

If you really want a reliable progress bar, you should create one using form fields and annotations.  This is much more reliable than the thermometer.

2 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
February 22, 2019

Do you know that this code is error free? Is anything displayed in the console window?

The thermometer object is problematic in a couple of ways. First, your code doesn't increase the increment. This is a small point, but the increment is a redraw prompt for the thermometer.  And redrawing is the second problem. The thermometer updates/redraws on free cpu cycles.  Unfortunately the JavaScript engine does not allow for many of these, it's a bit of a hog. If your code is too tight the thermometer may never be drawn, or even it it is shown initially it might not update as expected.

If you really want a reliable progress bar, you should create one using form fields and annotations.  This is much more reliable than the thermometer.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Inspiring
February 22, 2019

You don't show where the "doc" variable is defined and initialized. If it's elsewhere, could it be that it hasn't executed yet?

Jim_MacD1Author
Known Participant
February 22, 2019

'doc' is initialized earlier in code.