This blog is subject the DISCLAIMER below.

Wednesday, August 19, 2009

Check Acrobat Reader (PDF) installed : JavaScript with IE

Here you can find helper function I got by Google and do some changes to it to be suitable for me .It checks if the Acrobat Reader is installed in the browser or not (it tested on IE6 and IE7 with Acrobat 6 and 7).
Function returns : true for OK else false .

function CheckPDF()
{
var isInstalled = false;
var version = null;
if (window.ActiveXObject)
{
var control = null;
try {
// version 7
control = new ActiveXObject('AcroPDF.PDF');
}
catch (e)
{
// Do nothing
}
if (!control)
{
try {
//version 6
control = new ActiveXObject('PDF.PdfCtrl');
}
catch (e)
{
return false ;
}
}
if (control)
{

return true ;
}
else
{
return false ;
}
}
}

No comments: