Edit D:\chineseall_products\bak\digitalLib6\pages\screen\web\readers\js\pdf\pdf-plugin.js
var PdfReader = function(options) { this.version = "4.1.0.0"; this.domain = window.location.host; this.pdf = null; this.plugin = true; this._pageNum = options.pageNum; this._totalPageNum = options.totalPageNum; this._readLink = options.readLink; this._pageWidth = typeof (options.pageWidth) != "undefined" ? options.pageWidth : null; this._pageHeight = typeof (options.pageHeight) != "undefined" ? options.pageHeight : null; this._sessionId = typeof (options.sessionId) != "undefined" ? options.sessionId : null; this._rcUrl = "/pages/screen/web/readers/js/pdf/SC_TC_JP_KR.CAB"; this._patchPath = "/pages/screen/web/readers/js/pdf/PDFView.zip"; this.setOptions(typeof (options.toolbar) != "undefined" ? options.toolbar : {}); }; PdfReader.prototype = { setOptions : function(toolbar) { this.toolbar = { viewType : typeof (toolbar.viewType) != "undefined" ? toolbar.viewType : 2, // 2:?????5:??? fitType : typeof (toolbar.fitType) != "undefined" ? toolbar.fitType : "width", // width:?????eight:??? pageTurning : typeof (toolbar.pageTurning) != "undefined" ? toolbar.pageTurning : 2, // 2:????????3:?????? readPattern : typeof (toolbar.readPattern) != "undefined" ? toolbar.readPattern : 0, // 0:?????1:?????2:??? openZoom : typeof (toolbar.openZoom) != "undefined" ? toolbar.openZoom : true, // true:?????alse:??? openRotate : typeof (toolbar.openRotate) != "undefined" ? toolbar.openRotate : true, // true:?????alse:??? openNote : typeof (toolbar.openNote) != "undefined" ? toolbar.openNote : true, // true:?????alse:??? uploadLink : typeof (toolbar.uploadLink) != "undefined" ? toolbar.uploadLink : null // ???????????? }; }, initPdfReader : function() { this.plugin = checkPlugin(); if (!this.plugin) { this.buildInPdf(); } else { this.ycanPdf(); this.ycanConfig(); } }, checkVersion : function(curVersion, newVersion) { var newVer = newVersion.split('.'); var curVer = curVersion.split('.'); if (parseInt(newVer[0]) > parseInt(curVer[0])) { return true; } if (parseInt(newVer[0]) == parseInt(curVer[0]) && parseInt(newVer[1]) > parseInt(curVer[1])) { return true; } if (parseInt(newVer[0]) == parseInt(curVer[0]) && parseInt(newVer[1]) == parseInt(curVer[1]) && parseInt(newVer[2]) > parseInt(curVer[2])) { return true; } if (parseInt(newVer[0]) == parseInt(curVer[0]) && parseInt(newVer[1]) == parseInt(curVer[1]) && parseInt(newVer[2]) == parseInt(curVer[2]) && parseInt(newVer[3]) > parseInt(curVer[3])) { return true; } return false; }, buildInPdf : function() { var str = "<div id=\"container\">"; str += "<div class=\"lightbox\"></div>"; str += "<div id=\"pop\" class=\"pop\">"; str += "<canvas id=\"the-canvas\"></canvas>"; str += "</div>"; str += "</div>"; $("#pdfContentLoader").html(str); PDFJS.workerSrc = '/pages/screen/web/readers/js/pdf/pdf.worker.min.js'; //var h = $(window).height() - 155; //$("#pdfContentLoader").height(h); var link = "http://" + this.domain + this._readLink + "&pageNum=" + this._pageNum; PDFJS.getDocument(link).then(function getPdfPage(pdf) { pdf.getPage(1).then(function getPdfPage(page) { var scale = 1; var viewport = page.getViewport(scale); scale = $("#pdfContentLoader").width()/viewport.width; viewport = page.getViewport(scale); var canvas = document.getElementById('the-canvas'); var context = canvas.getContext('2d'); canvas.height = viewport.height; canvas.width = viewport.width; var renderContext = { canvasContext: context, viewport: viewport }; page.render(renderContext); $("#controlContainer").css("overflow","scroll"); $("#controlContainer").scrollTop(0); }); }); /* var agent = navigator.userAgent.toLowerCase(); var html = "<iframe id='pdfDisplayFrame' src='http://" + this.domain + this._readLink; html += "&pageNum=" + this._pageNum + "' "; if (agent.indexOf("pad") > 0 || agent.indexOf("mobile") > 0) { html += "width='" + this._width + "' height='"; html += this._pageHeight / this._pageWidth * 935 + "' "; } else { html += "width='100%' attrHeight='" + this._pageHeight + "' "; html += "attrWidth='" + this._pageWidth + "' "; var h = $(window).height() - 150; if(!this.plugin) h += 42; html += "height='" + h + "'"; } html += '></iframe>'; $("#pdfContentLoader").html(html); */ }, ycanPdf : function() { var tips = null; if (window.ActiveXObject || 'ActiveXObject' in window) { try { var obj = new ActiveXObject('PDFVIEWYC.PDFViewCtrl.1'); this.pdf = document.getElementById('YCanPDFIE'); } catch (e) { tips = '????????DF???????????????...'; } } else { // ??E var obj = navigator.plugins['npPDFViewyc dll']; if (obj == undefined) { tips = '????????DF???????????????...'; } else { this.pdf = document.getElementById('YCanPDFNOTIE'); } } if (tips == null) { var curVersion = this.pdf.GetVersion(); //if (!this.checkVersion(curVersion, this.version)) //return; // if (this.checkVersion(curVersion, this.version)) { // tips = '?????????????????????????????...'; // } else { // ??????????????????????????????????????????? // var curVer = this.pdf.GetVersionUpdate(this.version, "http://" // + this.domain + this._patchPath, 0); // if (curVer == "????????????") { // tips = '????????????,??????????????????????????!'; // } // } } if (tips != null) { $("#controlContainer") .html( '<a href="http://' + this.domain + '/pages/screen/web/readers/js/pdf/caPDFPluginInst.exe" class="install">' + tips + '</a>'); if (this.pdf != null) { this.pdf.CloseFile(); this.pdf = null; } } }, ycanConfig : function() { this.pdf.HttpSetVualue("JSESSIONID", this._sessionId, 0); this.pdf.SetRCURL("http://" + this.domain + this._rcUrl, 0); this.pdf.BeginBook(); for (var i = 1; i < this._totalPageNum; i++) { this.pdf.AddPage("http://" + this.domain + this._readLink + "&pageNum=" + i); } this.pdf.EndBook(); this.pdf.PageIndex = this._pageNum; if (this.toolbar.openNote && this.toolbar.uploadLink != null) { this.pdf.SetUpLoadPath("http://" + this.domain + this.toolbar.uploadLink, 5*1024*1024, 0); } this.pdf.SetViewType(this.toolbar.viewType); if (!"width" == this.toolbar.fitType) { this.pdf.FitHeight(); } else { this.pdf.FitWidth(); } }, getNoteRegionsSingle : function (commentIndex) { return this.pdf.getNoteRegions(commentIndex,""); } }; var checkPlugin = function() { var agent = navigator.userAgent.toLowerCase(); if (agent.indexOf("edge") > 0 || agent.indexOf("mobile") > 0 || agent.indexOf("pad") > 0 || agent.indexOf("mac") > 0) { return false; } else if (agent.indexOf("chrome") > 0) { if (agent.indexOf("linux") > 0) { return false; } else { var regStr_chrome = /chrome\/[\d.]+/gi; var v = (agent.match(regStr_chrome) + "").replace(/[^0-9.]/ig, ""); if (Number(v.substring(0, v.indexOf("."))) > 42) { return false; } } } return true; };
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de