Skip to main content
Inspiring
November 10, 2023
Answered

bringToFront() works inconsistently on Macs

  • November 10, 2023
  • 1 reply
  • 1943 views

           I reported this issue to Adobe in April 2021 but the problem persists. The short version is that on my Mac (but not on my PC), for no apparent reason, bringToFront() works most of the time but not always.

           bringToFront() is used in a function called from pdf form menus offering a choice of a variety of pdf forms. The function opens the selected form as docB and imports the client's fdf file (which works without failure) and ends with docB.bringToFront(), which works with all of the available forms most of the time, but sometimes leaves the target pdf in the background. Regardless of whether bringToFront() is positioned in my function before or after docB.importAnFDF(), its position in the function does not cure the occasional failure to bring the document to the front.

           I would appreciate any suggestions that may eliminate the occasional failure of bringToFront().

This topic has been closed for replies.
Correct answer BarlaeDC

Thank you. Yes, I have tried that but find no error. When bringToFront() fails, the form is opened and the data is imported but the form remains behind the calling form. 


Hi,

 

In that case I have one final thing, have you tried adding a wait or pause into your code, in case the open and import is meaning the bringToFront() is being successfully run but because something else is happening to the document it doesn't actually work.

1 reply

BarlaeDC
Community Expert
Community Expert
November 14, 2023

Hi,

 

Are you able to share the code that you use so that we can try and replicate the problem?

ODuinnAuthor
Inspiring
November 14, 2023
In my code below, var pathAndForm represents the form to be opened, including its path. The target form can be any one of 20 available forms and always opens. The issue is that on a Mac, not on a PC, occasionally the form is not brought to the front; it remains in the background. It is not any particular form, it can happen with any of them. I have a MacMini and MacBook Air and this occurs on both. If I experiment with a number of the forms bringToFront() may not fail, or it may fail with one or two out of x, but usually only one or two, never all of the forms.
 
var docB = app.openDoc({cPath: pathAndForm, oDoc: this});
docB.bringToFront();
ODuinnAuthor
Inspiring
November 20, 2023

Hi,

 

Many thanks from the response, based on the code you provided that was my best guess as to what could be going wrong, have you tried putting a try {}catch{} around the code and outputting ( or displaying a dialog to see if there is an error occuring?

 

try {
var docB = app.openDoc({cPath: pathAndForm, oDoc: this});
docB.bringToFront();
} catch (e) {
console.println( "error " + e)
}

 


Thank you. Yes, I have tried that but find no error. When bringToFront() fails, the form is opened and the data is imported but the form remains behind the calling form.