精华内容
下载资源
问答
  • PDFObject 可用

    2017-08-13 22:36:07
    PDFObject 下载可用
  • pdfobject.js

    千次下载 热门讨论 2014-05-11 19:39:29
    PDFObject.js是一个 JavaScript 库用来在HTML中动态嵌入 PDF 文档
  • All they need to do is load the latest version of PDFObject, the PDFObject utility will take care of the rest. 2.1 (dev branch) January 2017: Modified to support Mozilla's removal of navigator.mime...
  • PDFObject-master2.24.rar

    2020-12-16 10:08:42
    PDFObject-master2.24.rar PDFObject-master2.24.rar PDFObject-master2.24.rar PDFObject-master2.24.rar PDFObject-master2.24.rar
  • PDFObject.js

    2017-02-21 19:44:48
    PDFObject.js
  • pdfobject实现pdf在网页中在线浏览,其中包含代码和pdfobject.js,用于用户使用web工具浏览pdf.
  • PDFOBJECT.js

    2018-04-20 15:36:43
    pdfobject.js用来在HTML中动态嵌入 PDF 文档,预览pdf文档。
  • PDFObject-2.1.1.zip

    2020-08-04 16:08:27
    PDFObject.js 是一款在线预览 PDF 的 JQuery 插件,版本 V2.1.1 ,界面简洁,效果还不错,鉴于网上资源不好找,特此分享出来。
  • PDFObject_bysgl.zip

    2019-06-18 11:05:47
    PDFObject Js源码,非常优秀的pdf框架js源码,分析给大家
  • PDF显示脚本PDFObject.js

    2017-08-28 08:51:13
    PDFObject 2.0
  • pdfobject.js浏览器在线预览pdf。有些浏览器不支持pdf格式的,请看我另外一个pdf转换图片展示的资源。
  • PDFObject js打开PDF插件 简单可用 附送 第一本DOCKER书.pdf
  • 共三个js文件,分别为:pdf.js、pdf.worker.js、pdfobject.js,请根据自己的需求是否下载上述文件。 参考使用pdfobject.js地址:https://blog.csdn.net/Jon_Ronson/article/details/119607821
  • PDFObject在线载入PDF

    热门讨论 2014-04-22 17:01:49
    var success = new PDFObject({ url: "~/pdf/dtix201406-l.pdf" ,pdfOpenParams: { scrollbars: '0', toolbar: '0', statusbar: '0'}}).embed("pdf1"); }; </script> ; height:600px;">It appears you don't ...
  • 在线pdf预览插件pdfobject.js设置参数使用pdf预览
  • 前端预览PDF总结:iframe、embed、PDFObject、PDF.js

    万次阅读 多人点赞 2018-05-09 11:14:17
    这几个标签就能实现PDF文件的预览(无需JavaScript支持),我还在网上看了下发现挺多第三方js库可以实现PDF预览,如jQuery Document Viewer、jquery.media.js、PDFObject、PDF.js等等。我大概看了下PDFObject...

    要在网页上显示PDF文件,首先< object >、< embed >、< iframe >这几个标签就能实现PDF文件的预览(无需JavaScript支持),我还在网上看了下发现挺多第三方js库可以实现PDF预览,如jQuery Document Viewer、jquery.media.js、PDFObject、PDF.js等等。我大概看了下PDFObject、PDF.js这两个库,前者并不是一个PDF的渲染工具,而是通过使用< embed >标签来显示PDF;后者则会解析PDF文件内容,还能将PDF渲染成Canvas。

    < iframe >

    所有浏览器都支持 < iframe > 标签,直接将src设置为指定的PDF文件就可以预览了。此外可以把需要的文本放置在 < iframe > 和 之间,这样就可以应对无法理解 iframe 的浏览器,比如下面的代码可以提供一个PDF的下载链接:

    <iframe src="/index.pdf" width="100%" height="100%">
    
    This browser does not support PDFs. Please download the PDF to view it: <a href="/index.pdf">Download PDF</a>
    
    </iframe>

    < embed >

    < embed > 标签定义嵌入的内容,比如插件。在HTML5中这个标签有4个属性:

    属性描述
    heightpixels设置嵌入内容的高度。
    widthpixels设置嵌入内容的宽度。
    typetype定义嵌入内容的类型。
    srcurl嵌入内容的 URL。

    但是需要注意的是这个标签不能提供回退方案,与< iframe > < / iframe > 
    不同,这个标签是自闭合的的,也就是说如果浏览器不支持PDF的嵌入,那么这个标签的内容什么都看不到。用法如下:

    <embed src="/index.pdf" type="application/pdf" width="100%" height="100%">

    < object >

    < object >定义一个嵌入的对象,请使用此元素向页面添加多媒体。此元素允许您规定插入 HTML 文档中的对象的数据和参数,以及可用来显示和操作数据的代码。用于包含对象,比如图像、音频、视频、Java applets、ActiveX、PDF 以及 Flash。几乎所有主流浏览器都拥有部分对 < object > 标签的支持。这个标签在这里的用法和< iframe >很小,也支持回退:

    <object data="/index.php" type="application/pdf" width="100%" height="100%">
    
    This browser does not support PDFs. Please download the PDF to view it: <a href="/index.pdf">Download PDF</a>
    
    </object>

    当然,结合< object >和< iframe >能提供一个更强大的回退方案:

    <object data="/index.pdf" type="application/pdf" width="100%" height="100%">
    
    <iframe src="/index.pdf" width="100%" height="100%" style="border: none;">
    
    This browser does not support PDFs. Please download the PDF to view it: <a href="/index.pdf">Download PDF</a>
    
    </iframe>
    
    </object>

    以上三个标签是一种无需JavaScript支持的PDF预览方案。下面提到的PDFObject和PDF.js都是js库。

    PDFObject

    看官网上的介绍,PDFObject并不是一个PDF渲染工具,它也是通过< embed >标签实现PDF预览:

    PDFObject is not a rendering engine. PDFObject just writes an < embed > element to the page, and relies on the browser or browser plugins to render the PDF. If the browser does not support embedded PDFs, PDFObject is not capable of forcing the browser to render the PDF.

    PDFObject提供了一个PDFObject.supportsPDFs用于判断该浏览器能否使用PDFObject:

    if(PDFObject.supportsPDFs){
       console.log("Yay, this browser supports inline PDFs.");
    } else {
       console.log("Boo, inline PDFs are not supported by this browser");
    }

    整个PDFObject使用起来非常简单,完整代码:

    <!DOCTYPE html>
    <html>
    <head>
        <title>Show PDF</title>
        <meta charset="utf-8" />
        <script type="text/javascript" src='pdfobject.min.js'></script>
        <style type="text/css">
            html,body,#pdf_viewer{
                width: 100%;
                height: 100%;
                margin: 0;
                padding: 0;
            }
        </style>
    </head>
    <body>
        <div id="pdf_viewer"></div>
    </body>
    <script type="text/javascript">
        if(PDFObject.supportsPDFs){
            // PDF嵌入到网页
            PDFObject.embed("index.pdf", "#pdf_viewer" );
        } else {
            location.href = "/canvas";
        }
    </script>
    </html>

    PDF.js

    PDF.js可以实现在html下直接浏览pdf文档,是一款开源的pdf文档读取解析插件,非常强大,能将PDF文件渲染成Canvas。PDF.js主要包含两个库文件,一个pdf.js和一个pdf.worker.js,一个负责API解析,一个负责核心解析。 
    首先引入pdf.js文件<script type="text/javascript" src='pdf.js'></script> 
    PDF.js大部分用法都是基于Promise的,PDFJS.getDocument(url)方法返回的就是一个Promise:

     PDFJS.getDocument('../index.pdf').then(pdf=>{
            var numPages = pdf.numPages;
            var start = 1;
            renderPageAsync(pdf, numPages, start);
        });

    Promise返回的pdf是一个PDFDocumentProxy对象官网API介绍是:

    Proxy to a PDFDocument in the worker thread. Also, contains commonly used properties that can be read synchronously.

    PDF的解析工作需要通过pdf.getPage(page)去执行,这个方法返回的也是一个Promise,因此可以通过async/await函数去逐页解析PDF:

    async function renderPageAsync(pdf, numPages, current){
            for(let i=1; i<=numPages; i++){
                // 解析page
                let page = await pdf.getPage(i);
                // 渲染
                // ...
            }
        }

    得到的page是一个PDFPageProxy对象,即Proxy to a PDFPage in the worker thread 。这个对象得到了这一页的PDF解析结果,我们可以看下这个对象提供的方法:

    方法返回
    getAnnotationsA promise that is resolved with an {Array} of the annotation objects.
    getTextContentThat is resolved a TextContent object that represent the page text content.
    getViewportContains ‘width’ and ‘height’ properties along with transforms required for rendering.
    renderAn object that contains the promise, which is resolved when the page finishes rendering.

    我们可以试试调用getTextContent方法,并将其结果打印出来:

    page.getTextContent().then(v=>console.log('page', v));

    第一页部分结果如下:

    {
        "items": [
            {
                "str": "小册子标题",
                "dir": "ltr",
                "width": 240,
                "height": 2304,
                "transform": [
                    48,
                    0,
                    0,
                    48,
                    45.32495,
                    679.04
                ],
                "fontName": "g_d0_f1"
            },
            {
                "str": " ",
                "dir": "ltr",
                "width": 9.600000000000001,
                "height": 2304,
                "transform": [
                    48,
                    0,
                    0,
                    48,
                    285.325,
                    679.04
                ],
                "fontName": "g_d0_f2"
            }
          ],
        "styles": {
            "g_d0_f1": {
                "fontFamily": "monospace",
                "ascent": 1.05810546875,
                "descent": -0.26171875,
                "vertical": false
            },
            "g_d0_f2": {
                "fontFamily": "sans-serif",
                "ascent": 0.74365234375,
                "descent": -0.25634765625
            }
        }
     }

    我们可以发现,PDF.js将每页文本的字符串、位置、字体都解析出来,感觉还是挺厉害的。

    官网有个demo,还用到了官网提到的viewer.js(我认为它的作用是对PDF.js渲染结果再次处理):http://mozilla.github.io/pdf.js/web/viewer.html,我看了一下它的HTML机构,首先底图是一个Canvas,内容和PDF一样(通过下面介绍的page.render方法可以得到),底图之上是一个textLayer,我猜想这一层就是通过page.getTextContent()得到了字体的位置和样式,再覆盖在Canvas上: 


    通过这种方式就能实现再预览文件上选中文字(刚开始我还在纳闷为什么渲染成Canvas还能选择文字)

    将page渲染成Canvas是通过render方法实现的,代码如下:

    async function renderPageAsync(pdf, numPages, current){
            console.log("renderPage async");
            for(let i=1; i<=numPages; i++){
                // page
                let page = await pdf.getPage(i);
    
                let scale = 1.5;
                let viewport = page.getViewport(scale);
                // Prepare canvas using PDF page dimensions.
                let canvas = document.createElement("canvas");
                let context = canvas.getContext('2d');
                document.body.appendChild(canvas);
    
                canvas.height = viewport.height;
                canvas.width = viewport.width;
    
                // Render PDF page into canvas context.
                let renderContext = {
                        canvasContext: context,
                        viewport: viewport
                };
                page.render(renderContext);
            }
        }

    PDF.js是Mozilla实验室的作品,感觉真的很强大! 
    我在码云上有个demo,结合了PDFObject和PDF.js。因为PDFObject使用的< embed >标签可以直接显示PDF文件,速度很快;但是手机上很多浏览器不支持,比如微信的浏览器、小米浏览器,所以我就使用了PDF.js将其渲染成Canvas,速度与PDFObject相比慢多了,但至少能看。-_-|| 
    demo地址:https://git.oschina.net/liuyaqi/PDFViewer.git

    参考: 
    PDFObject:https://pdfobject.com 
    PDF.js: http://mozilla.github.io/pdf.js/

     


     

    前端每日一题,带你走入高级前端之路!每天早上9点左右更新题目及前一天的答案!

    github地址:https://github.com/qappleh/Web-Daily-Question/

     

    推荐web程序员必备微信号 

    web夜读课

    微信号:ydhlwnxs

    推荐理由:web开发人员都在关注的公众号,在多学一点知识,就可以少写一行代码!专注于技术资源分享,经验交流,最新技术解读,另有海量免费电子书以及成套学习资源,关注web夜读课,做技术得先驱者。

     ▼长按下方↓↓↓二维码识别关注

    展开全文
  • pdfobject div中预览pdf

    2020-05-19 15:08:24
    new PDFObject({ url: "PDF路径" }).embed("div的id"); <script type="text/javascript" src="/js/static/js/pdfobject.js"></script> <script> window.onload = function() { new PDFObject({...
     new PDFObject({ url: "PDF路径" }).embed("div的id");
    
    <script type="text/javascript" src="/js/static/js/pdfobject.js"></script>
    <script>
        window.onload = function() {
            new PDFObject({ url: "/js/static/pdf/sample.pdf" }).embed("pdfPre");
        };
    </script>
    
    <div class="box" style="margin: 10px;height:95%;width:95%">
        <div class="color1" id="pdfPre" style="left:0">
        </div>
    </div>

     

    效果:

    展开全文
  • vue中使用PDFobject的坑

    千次阅读 2019-04-23 14:49:08
    1.pdfobject.js /*global ActiveXObject, window, console, define, module, jQuery */ //jshint unused:false, strict: false /* PDFObject v2.1.1 https://github.com/pipwerks/PDFObject Copyrigh...

    1.pdfobject.js

    /*global ActiveXObject, window, console, define, module, jQuery */
    //jshint unused:false, strict: false
    
    /*
        PDFObject v2.1.1
        https://github.com/pipwerks/PDFObject
        Copyright (c) 2008-2018 Philip Hutchison
        MIT-style license: http://pipwerks.mit-license.org/
        UMD module pattern from https://github.com/umdjs/umd/blob/master/templates/returnExports.js
    */
    
    (function (root, factory) {
        if (typeof define === 'function' && define.amd) {
            // AMD. Register as an anonymous module.
            define([], factory);
        } else if (typeof module === 'object' && module.exports) {
            // Node. Does not work with strict CommonJS, but
            // only CommonJS-like environments that support module.exports,
            // like Node.
            module.exports = factory();
        } else {
            // Browser globals (root is window)
            root.PDFObject = factory();
      }
    }(this, function () {
    
        "use strict";
        //jshint unused:true
    
        //PDFObject is designed for client-side (browsers), not server-side (node)
        //Will choke on undefined navigator and window vars when run on server
        //Return boolean false and exit function when running server-side
    
        if(typeof window === "undefined" || typeof navigator === "undefined"){ return false; }
    
        var pdfobjectversion = "2.1.1",
            ua = window.navigator.userAgent,
    
            //declare booleans
            supportsPDFs,
            isIE,
            supportsPdfMimeType = (typeof navigator.mimeTypes['application/pdf'] !== "undefined"),
            supportsPdfActiveX,
            isModernBrowser = (function (){ return (typeof window.Promise !== "undefined"); })(),
            isFirefox = (function (){ return (ua.indexOf("irefox") !== -1); } )(),
            isFirefoxWithPDFJS = (function (){
                //Firefox started shipping PDF.js in Firefox 19.
                //If this is Firefox 19 or greater, assume PDF.js is available
                if(!isFirefox){ return false; }
                //parse userAgent string to get release version ("rv")
                //ex: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:57.0) Gecko/20100101 Firefox/57.0
                return (parseInt(ua.split("rv:")[1].split(".")[0], 10) > 18);
            })(),
            isIOS = (function (){ return (/iphone|ipad|ipod/i.test(ua.toLowerCase())); })(),
    
            //declare functions
            createAXO,
            buildFragmentString,
            log,
            embedError,
            embed,
            getTargetElement,
            generatePDFJSiframe,
            generateEmbedElement;
    
    
        /* ----------------------------------------------------
           Supporting functions
           ---------------------------------------------------- */
    
        createAXO = function (type){
            var ax;
            try {
                ax = new ActiveXObject(type);
            } catch (e) {
                ax = null; //ensure ax remains null
            }
            return ax;
        };
    
        //IE11 still uses ActiveX for Adobe Reader, but IE 11 doesn't expose
        //window.ActiveXObject the same way previous versions of IE did
        //window.ActiveXObject will evaluate to false in IE 11, but "ActiveXObject" in window evaluates to true
        //so check the first one for older IE, and the second for IE11
        //FWIW, MS Edge (replacing IE11) does not support ActiveX at all, both will evaluate false
        //Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
        isIE = function (){ return !!(window.ActiveXObject || "ActiveXObject" in window); };
    
        //If either ActiveX support for "AcroPDF.PDF" or "PDF.PdfCtrl" are found, return true
        //Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
        supportsPdfActiveX = function (){ return !!(createAXO("AcroPDF.PDF") || createAXO("PDF.PdfCtrl")); };
    
        //Determines whether PDF support is available
        supportsPDFs = (
            //as of iOS 12, inline PDF rendering is still not supported in Safari or native webview
            //3rd-party browsers (eg Chrome, Firefox) use Apple's webview for rendering, and thus the same result as Safari
            //Therefore if iOS, we shall assume that PDF support is not available
            !isIOS && (
                //Modern versions of Firefox come bundled with PDFJS
                isFirefoxWithPDFJS || 
                //Browsers that still support the original MIME type check
                supportsPdfMimeType || (
                    //Pity the poor souls still using IE
                    isIE() && supportsPdfActiveX()
                )
            )
        );
    
        //Create a fragment identifier for using PDF Open parameters when embedding PDF
        buildFragmentString = function(pdfParams){
    
            var string = "",
                prop;
    
            if(pdfParams){
    
                for (prop in pdfParams) {
                    if (pdfParams.hasOwnProperty(prop)) {
                        string += encodeURIComponent(prop) + "=" + encodeURIComponent(pdfParams[prop]) + "&";
                    }
                }
    
                //The string will be empty if no PDF Params found
                if(string){
    
                    string = "#" + string;
    
                    //Remove last ampersand
                    string = string.slice(0, string.length - 1);
    
                }
    
            }
    
            return string;
    
        };
    
        log = function (msg){
            if(typeof console !== "undefined" && console.log){
                console.log("[PDFObject] " + msg);
            }
        };
    
        embedError = function (msg){
            log(msg);
            return false;
        };
    
        getTargetElement = function (targetSelector){
    
            //Default to body for full-browser PDF
            var targetNode = document.body;
    
            //If a targetSelector is specified, check to see whether
            //it's passing a selector, jQuery object, or an HTML element
    
            if(typeof targetSelector === "string"){
    
                //Is CSS selector
                targetNode = document.querySelector(targetSelector);
    
            } else if (typeof jQuery !== "undefined" && targetSelector instanceof jQuery && targetSelector.length) {
    
                //Is jQuery element. Extract HTML node
                targetNode = targetSelector.get(0);
    
            } else if (typeof targetSelector.nodeType !== "undefined" && targetSelector.nodeType === 1){
    
                //Is HTML element
                targetNode = targetSelector;
    
            }
    
            return targetNode;
    
        };
    
        generatePDFJSiframe = function (targetNode, url, pdfOpenFragment, PDFJS_URL, id){
    
            var fullURL = PDFJS_URL + "?file=" + encodeURIComponent(url) + pdfOpenFragment;
            var scrollfix = (isIOS) ? "-webkit-overflow-scrolling: touch; overflow-y: scroll; " : "overflow: hidden; ";
            var iframe = "<div style='" + scrollfix + "position: absolute; top: 0; right: 0; bottom: 0; left: 0;'><iframe  " + id + " src='" + fullURL + "' style='border: none; width: 100%; height: 100%;' frameborder='0'></iframe></div>";
            targetNode.className += " pdfobject-container";
            targetNode.style.position = "relative";
            targetNode.style.overflow = "auto";
            targetNode.innerHTML = iframe;
            return targetNode.getElementsByTagName("iframe")[0];
    
        };
    
        generateEmbedElement = function (targetNode, targetSelector, url, pdfOpenFragment, width, height, id){
    
            var style = "";
    
            if(targetSelector && targetSelector !== document.body){
                style = "width: " + width + "; height: " + height + ";";
            } else {
                style = "position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;";
            }
    
            targetNode.className += " pdfobject-container";
            targetNode.innerHTML = "<embed " + id + " class='pdfobject' src='" + url + pdfOpenFragment + "' type='application/pdf' style='overflow: auto; " + style + "'/>";
    
            return targetNode.getElementsByTagName("embed")[0];
    
        };
    
        embed = function(url, targetSelector, options){
    
            //Ensure URL is available. If not, exit now.
            if(typeof url !== "string"){ return embedError("URL is not valid"); }
    
            //If targetSelector is not defined, convert to boolean
            targetSelector = (typeof targetSelector !== "undefined") ? targetSelector : false;
    
            //Ensure options object is not undefined -- enables easier error checking below
            options = (typeof options !== "undefined") ? options : {};
    
            //Get passed options, or set reasonable defaults
            var id = (options.id && typeof options.id === "string") ? "id='" + options.id + "'" : "",
                page = (options.page) ? options.page : false,
                pdfOpenParams = (options.pdfOpenParams) ? options.pdfOpenParams : {},
                fallbackLink = (typeof options.fallbackLink !== "undefined") ? options.fallbackLink : true,
                width = (options.width) ? options.width : "100%",
                height = (options.height) ? options.height : "100%",
                assumptionMode = (typeof options.assumptionMode === "boolean") ? options.assumptionMode : true,
                forcePDFJS = (typeof options.forcePDFJS === "boolean") ? options.forcePDFJS : false,
                PDFJS_URL = (options.PDFJS_URL) ? options.PDFJS_URL : false,
                targetNode = getTargetElement(targetSelector),
                fallbackHTML = "",
                pdfOpenFragment = "",
                fallbackHTML_default = "<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>";
    
            //If target element is specified but is not valid, exit without doing anything
            if(!targetNode){ return embedError("Target element cannot be determined"); }
    
    
            //page option overrides pdfOpenParams, if found
            if(page){
                pdfOpenParams.page = page;
            }
    
            //Stringify optional Adobe params for opening document (as fragment identifier)
            pdfOpenFragment = buildFragmentString(pdfOpenParams);
    
            //Do the dance
    
            //If the forcePDFJS option is invoked, skip everything else and embed as directed
            if(forcePDFJS && PDFJS_URL){
    
                return generatePDFJSiframe(targetNode, url, pdfOpenFragment, PDFJS_URL, id);
    
            //If traditional support is provided, or if this is a modern browser and not iOS (see comment for supportsPDFs declaration)
            } else if(supportsPDFs || (assumptionMode && isModernBrowser && !isIOS)){
    
                return generateEmbedElement(targetNode, targetSelector, url, pdfOpenFragment, width, height, id);
    
            //If everything else has failed and a PDFJS fallback is provided, try to use it
            } else if(PDFJS_URL){
    
                return generatePDFJSiframe(targetNode, url, pdfOpenFragment, PDFJS_URL, id);
    
            } else {
    
                //Display the fallback link if available
                if(fallbackLink){
    
                    fallbackHTML = (typeof fallbackLink === "string") ? fallbackLink : fallbackHTML_default;
                    targetNode.innerHTML = fallbackHTML.replace(/\[url\]/g, url);
    
                }
    
                return embedError("This browser does not support embedded PDFs");
    
            }
    
        };
    
        return {
            embed: function (a,b,c){ return embed(a,b,c); },
            pdfobjectversion: (function () { return pdfobjectversion; })(),
            supportsPDFs: (function (){ return supportsPDFs; })()
        };
    
    }));

    2.usePDF.vue

    <template>
      <div class="flex-wrapper">
            <header class="index-header">
            </header>
            <section>
                <div id="pdf_viewer">
                    
                </div>
            </section>
        </div>
    </template>
    
    <script>
    const { PDFObject } =require('../../assets/js/pdfobject')
    export default {
      data() {
        return {
    
        };
      },
      methods: {
          
      },
      created() {
    
      },
      mounted() {
        PDFObject.embed("../../../static/你不知道的JavaScript(中卷)@www.java1234.com .pdf", "#pdf_viewer");
      },
    }
    </script>
    
    
    
    
    
    

     

    展开全文
  • 引入pdfobject.js。 在csdn的资源里可以搜到 页面内定义一个DIV PDFObject.embed(’<%=basePath%>’+json.url, “#ysjl”); VUE内使用 安装 npm i pdfobject --save 引入 import pdf from ‘pdfobject’ 指定...

    JSP在线预览PDF
    引入pdfobject.js。 在csdn的资源里可以搜到

    页面内定义一个DIV

    <div id="ysjl" style="height:600px"></div>
    

    PDFObject.embed(’<%=basePath%>’+json.url, “#ysjl”);

    VUE内使用

    安装
    npm i pdfobject --save

    引入
    import pdf from ‘pdfobject’

    指定元素

    <template>
        <div id="pdf-content">
        </div>
    </template>
    

    填充
    pdf.embed("…/…/static/pdf.pdf", “#pdf-content”);

    展开全文
  • 支持到ie9可以不用安装 如果安装 npm ipdfobject 第一步:引入pdfObject包申明一个变量 const { PDFObject } = require("../../assets/js/pdfobject"); 组件中:写一个存放的位置 <div id="pdfContent...
  • PDFObject的使用(转)

    2019-07-08 14:19:00
    1.pdfobject.js官网:https://pdfobject.com/ 2.在html文件中引入这个文件,以pdfobject.min.js为例 1 <scripttype="text/javascript" src="js/pdfobject.min.js"></script> ...
  • 在线预览 PDF 文档插件 PDFObject.js

    千次阅读 2019-09-26 16:59:07
    插件描述: ...embed> 标签显示 PDF 文档 官网:https://pdfobject.com/ 使用步骤: ...1、下载 pdfobject.js GitHub 下载:https://github.com/pipwerks/PDFObject/ 2、在需要使用的 html 页...
  • https://pdfobject.com/
  • PDFObject.js的使用

    千次阅读 2017-05-27 16:09:19
    首先导入PDFObject.js文件,然后在加入下面的代码段 window.onload = function (){  var myPDF = new PDFObject({ url:"这里是pdf的文件地址" }).embed();   }; PDFObject.js可跨域访问文件。
  • PDFObject.zip

    2021-06-23 15:40:15
    pdf在we显示

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 766
精华内容 306
关键字:

pdfobject