/* PDFObject v1.2.20111123 https://github.com/pipwerks/PDFObject Copyright (c) Philip Hutchison MIT-style license: http://pipwerks.mit-license.org/ */ /*jslint browser: true, sloppy: true, white: true, plusplus: true */ /*global ActiveXObject, window */ var PDFObject = function (obj){ if(!obj || !obj.url){ return false; } var pdfobjectversion = "1.2", //Set reasonable defaults id = obj.id || false, width = obj.width || "100%", height = obj.height || "100%", pdfOpenParams = obj.pdfOpenParams, url, pluginTypeFound, //declare functions createAXO, hasReaderActiveX, hasReader, hasGeneric, pluginFound, setCssForFullWindowPdf, buildQueryString, get, embed; /* ---------------------------------------------------- Supporting functions ---------------------------------------------------- */ createAXO = function (type){ var ax; try { ax = new ActiveXObject(type); } catch (e) { //ensure ax remains null ax = null; } return ax; }; //Tests specifically for Adobe Reader (aka Acrobat) in Internet Explorer hasReaderActiveX = function (){ var axObj = null; if (window.ActiveXObject) { axObj = createAXO("AcroPDF.PDF"); //If "AcroPDF.PDF" didn't work, try "PDF.PdfCtrl" if(!axObj){ axObj = createAXO("PDF.PdfCtrl"); } //If either "AcroPDF.PDF" or "PDF.PdfCtrl" are found, return true if (axObj !== null) { return true; } } //If you got to this point, there's no ActiveXObject for PDFs return false; }; //Tests specifically for Adobe Reader (aka Adobe Acrobat) in non-IE browsers hasReader = function (){ var i, n = navigator.plugins, count = n.length, regx = /Adobe Reader|Adobe PDF|Acrobat/gi; for(i=0; i'; return targetNode.getElementsByTagName("object")[0]; }; //The hash (#) prevents odd behavior in Windows //Append optional Adobe params for opening document url = encodeURI(obj.url) + "#" + buildQueryString(pdfOpenParams); pluginTypeFound = pluginFound(); this.get = function(prop){ return get(prop); }; this.embed = function(id){ return embed(id); }; this.pdfobjectversion = pdfobjectversion; return this; };