Expand my Community achievements bar.

closedoc on initialization

Avatar

Former Community Member

Hi,

  I´ve got document checking the reader version during the initialization: if lower than 8.0 I need to shutdown the initialization process and close the document. If process goes on, there will be plenty of error windows (cause of scripting for new versions of the reader), what I want the user to be prevented from(if he has older version).

For closing, I am using this JSsequence:

var myDoc = event.target;
myDoc.closeDoc(true);

which is working fine when on button.click etc., but NOT working in form.initialize ! Is there some way to just shot down the document during the initialization?

I guess event.target is not returning the variable when doc is not initilalized.

Thanks for any suggestion and idea!

5 Replies

Avatar

Former Community Member

The issue is a handoff issue between XFA plugin and AcroForms. The initialize event fires before the form is ready and hence the objects do not exist until the form is loaded in Acrobat. I woudl suggest trying to use a setTimeout command to execute your close at a time in the future. The setTimeout is an AcroForm command and as such will accept an acroform command to execute in the future. So try this line of code on the DocReady event:

var temp = app.setTimeOut("this.closeDoc(true)", 2000);

In this context the "this" refers to the doc object in Acroform. The 2000 is the number of milliseconds to wait before executing the command.

Hope that helps

Paul

Avatar

Level 4

You could also try firing the button click event in the initialize function.

Avatar

Former Community Member

oh, great thanks! I´ll test it on the older version later, but shutting down the form correctly.

Avatar

Former Community Member

AKloft: it is the same for me, while the command will be run during the initialization.

Avatar

Former Community Member

yes, it´s working fine, but is there some way how to close the Reader instantly? This is working shomehow good, but I´ve got to click through the error msg boxes first...