Expand my Community achievements bar.

Version Control

Avatar

Former Community Member
How could I prevent a user from using older version of Reader <7 and Acrobat <9?



Is there a way to have it open in Reader by default?



Thanks,
4 Replies

Avatar

Level 10
Hi,



You could try something like this:



var oType = xfa.host.appType;

var oVersion = xfa.host.version;



if (oType == "Reader" && oVersion < 7)

{

app.alert("some message...);

}



if (oType == "Extended" | oType == "Extended-Pro" && oVersion < 9)

{

app.alert("a different message...");

}



I haven't tested it and I know from previous experience that it is difficult to get a "app.execMenuItem("Close");" script to work. The best we achieved was to have a hidden numeric field with the initialised value set to zero. This hidden field had script, if its value was changed to 1 then it executed the "close" script.



If the criteria was met that the file should not be opened instead of the app.alert above we had script thta changed the value from 0 to 1, invoking the "close" event. Because the PDF had changed (numeric field changing from 0 to 1) the user was asked if they wanted to save the file before closing. As part of that was a cancel button, which if clicked meant that the file did not close.



This was a real messy work around, so I will be interested to see if someone has a more elegant solution.



Good luck,



Niall

Avatar

Former Community Member
You can set the target version in File/Form Properties/Defaults. if they open with something earlier then a warning is displayed. They will be able to continue if they choose. You can write javascript that can check the versions as well as the viewer (Acrobat or Reader) and not allow them to continue if you want.

Avatar

Former Community Member
Thank Niall! works great!



How about making the subform presence hidden? For me that makes the form useless. :D



Thank you again!

Avatar

Level 10
Glad it worked for you!



In addition to the app.alerts you could have script like:



subform.presence = "hidden";



I would keep the app.alerts, so that you are informing the user why the file has just gone blank!



Good luck,



Niall