PDFObject.js去掉下载和打印功能
来源:互联网 发布:记事本如何编译java 编辑:程序博客网 时间:2024/06/06 23:58
c.innerHTML = '<object data="' + a + '" type="application/pdf" style="margin-top:-50px;" width="' + i + '" height="' + z + '"></object>';
加个 var isload = y.isload;属性判断是否显示,
js实现:
function OpenPDF(fileurl)
{
var myPDF = new PDFObject({ url: fileurl,isload:false }).embed();
}
PDFObject.js
/* PDFObject, copyright (C) 2008 Philip Hutchison (pipwerks.com). Documentation and examples are at www.pdfobject.com. Version 1.2, April 2011. MIT style license */
var PDFObject = function (y) {
if (!y || !y.url)
{ return false; }
var w = "1.2", b = y.id || false, i = y.width || "100%", z = y.height || "100%", r = y.pdfOpenParams, a, x;
var isload = y.isload;
var v = function () {
var c = null;
if (window.ActiveXObject) {
c = new ActiveXObject("AcroPDF.PDF");
if (!c)
{
c = new ActiveXObject("PDF.PdfCtrl");
}
if (c !== null)
{
return true;
}
} return false;
};
var u = function () {
var c, f = navigator.plugins, d = f.length, e = /Adobe Reader|Adobe PDF|Acrobat/gi;
for (c = 0; c < d; c++) {
if (e.test(f[c].name))
{ return true; }
} return false;
};
var t = function () {
var c = navigator.mimeTypes["application/pdf"];
return (c && c.enabledPlugin);
};
var s = function () {
var c = null;
if (u() || v()) { c = "Adobe"; }
else {
if (t()) { c = "generic"; }
} return c;
};
var q = function () {
var e = document.getElementsByTagName("html");
if (!e)
{
return false;
}
var c = e[0].style, d = document.body.style;; c.height = "100%"; c.overflow = "hidden"; d.margin = "0"; d.padding = "0"; d.height = "100%"; d.overflow = "hidden";
};
var p = function (d) {
var c = "", e;
if (!d)
{ return c; }
for (e in d) {
if (d.hasOwnProperty(e)) {
c += e + "=";
if (e === "search") { c += encodeURI(d[e]); } else { c += d[e]; } c += "&";
}
} return c.slice(0, c.length - 1);
};
var o = function (d) {
var c = null;
switch (d) {
case "url": c = a; break;
case "id": c = b; break;
case "width": c = i; break;
case "height": c = z; break;
case "pdfOpenParams": c = r; break;
case "pluginTypeFound": c = x; break;
case "pdfobjectversion": c = w; break;
} return c;
};
var n = function (d) {
if (!x) { return false; }
var c = null;
if (d) {
c = (d.nodeType && d.nodeType === 1) ? d : document.getElementById(d);
if (!c) { return false; }
} else { c = document.body; q(); i = "100%"; z = "100%"; }
var t;
if (isload)
{
//c.innerHTML = '<object data="' + a + '" type="application/pdf" width="' + i + '" height="' + z + '"></object>';
t = '<object data="' + a + '" type="application/pdf" width="' + i + '" height="' + z + '"></object>';
} else
{
t = '<object data="' + a + '" type="application/pdf" style="margin-top:-50px;" width="' + i + '" height="' + z + '"></object>';
}
OpenWin(t);
//return c.getElementsByTagName("object")[0];
};
a = encodeURI(y.url) + "#" + p(r); x = s();
this.get = function (c) { return o(c); };
this.embed = function (c) { return n(c); };
return this;
};
function OpenWin(html)
{
layer.open({
type: 1,
title:null,
shadeClose: true,
area: ['70%', '70%'],
content: html
});
}
- PDFObject.js去掉下载和打印功能
- pdfobject.js和pdf.js的详解
- js打印去掉网址和日期
- PDFObject.js的使用
- js pdf展示插件(pdfobject)
- pdf.js隐藏打印和下载按钮
- JS 实现在IE浏览器下的打印功能的去掉页眉页尾代码
- PAZU 打印控件 去掉js打印上面的页码和下面的日期
- JS 实现打印功能
- js调打印功能
- js打印功能
- JS打印功能
- js打印功能实现
- js调用打印功能
- js 打印功能
- js打印功能
- JS中的打印功能
- JS 实现打印功能
- 【脚本语言系列】关于PythonNoSQL数据库处理redis,你需要知道的事
- easyui propertyGrid
- RxJava使用场景小结
- 国内阿里Maven仓库镜像Maven配置文件Maven仓库速度快
- KMP算法详解与Java实现
- PDFObject.js去掉下载和打印功能
- 三菱PLC与研华webaccess以太网通讯配置
- CodeChef AUG14 SIGFIB
- Winform动态增加ComboBox后SelectedValue无效的问题
- IP地址分类
- 如何创建产生正弦波的mif文件
- Protocol Buffer Basics指导: C++
- 使用Merge优化改写一个update语句
- Hbase优化