附件預覽之前一直採用將pdf文件轉成swf文件然後再用flash預覽,可是有些客戶端是禁止安裝flash,於是就採用PDFObject.js,在虛擬機中調試PDFObject.js,一直報錯:automation 服務器不能創建對象,調試了一會,查閱了下源碼,才意識到是虛擬機中沒有安裝Adobe Reader,安裝後,妥妥的打開了。。。
//Tests specifically for Adobe Reader (aka Acrobat) in Internet Explorer
var hasReaderActiveX = function (){
var axObj = null;
if (window.ActiveXObject) {
axObj = new ActiveXObject("AcroPDF.PDF");
//If "AcroPDF.PDF" didn't work, try "PDF.PdfCtrl"
if(!axObj){
axObj = new ActiveXObject("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;
};