Display PDF files in Web pages and popup pdf in Vue project

Source: Internet
Author: User



1. <embed width= "height=" src= "test_pdf.pdf" > </embed>


<embed v-show= "pdfshow" width= "height=" "src=". /.. /.. /public/data/significant.pdf "> </embed>


Browsers through: , Firefox, IE, Chrome

2, <object classid= "clsid:ca8a9780-280d-11cf-a24d-444553540000" width= "" "height=" "border=" 0 ">

<param name= "SRC" value= "Test_pdf.pdf" >

</object>

Here's the complete point:

<object classid= "clsid:ca8a9780-280d-11cf-a24d-444553540000" width= "100%" height= "100%" border= "0" ><!-- Ie-->
<param name= "_version" value= "65539" >
<param name= "_extentx" value= "20108" >
<param name= "_extenty" value= "10866" >
<param name= "_stockprops" value= "0" >
<param name= "SRC" value= "Testing_pdf.pdf" >
<embed src= "testing_pdf.pdf" width= "100%" height= "$" href= "testing_pdf.pdf" ></embed><!--ff-->
</object>

Browsers through:, IE

Browsers not approved: Firefox, Chrome

3. <iframe src= "test_pdf.pdf" width= "height=" ></iframe>

<iframe src= ". /.. /.. /public/data/significant.pdf "width=" "height=" ></iframe>



Browsers through: Firefox, IE, Chrome

4, direct access to http://127.0.0.1/test_pdf.pdf with the browser (in fact this is not in the Web bar)



Browsers through:Firefox, IE, Chrome









Original website: https://www.jb51.net/article/117166.htm



Https://www.npmjs.com/package/vueshowpdf





Installnpm Install vueshowpdf-sQuick Start//template<vueshowpdf @closepdf="Closepdf"V-model="Isshowpdf":p Dfurl="Pdfurls"@pdferr="Pdferr": Maxscale= ' 4 '  :minscale= 0.6 '  :scale= ' 1.1   ></vueshowpdf>  <span class= "compare" @click = "Sigtab" > Significance test Table </span>//javascriptImport vueshowpdf from ' vueshowpdf'  vue.component ("Vueshowpdf", vueshowpdf);Export default { Data:{ return:{ //pdfurls:'//cdn.mozilla.net/pdfjs/tracemonkey.pdf',      pdfurls: ' Http://localhost:3000/data/significant.pdf ',isshowpdf:false         }           },methods:{       Sigtab () {this.isshowpdf=true}, closepdf(){ This . Isshowpdf = false         }, pdferr(errurl) { console. Log(Errurl);         }    },Components:{ vueshowpdf    }  }


# # parameter Description


    • Closepdf is the starting function when you close the PDF.
    • V-model whether to display PDF
    • Pdfurl file Address of PDF
    • Pdferr file Address Resolution error when the function that is triggered returns the wrong PDF address
    • Maxscale Maximum magnification default 2
    • Minscale minimum magnification default 0.8
    • Scale default magnification default 1.2


Server.js


Const EXPRESS = require (' Express ');Const PATH = require (' path ');App.use (Express.static (Path.join (__dirname, ' Public ' ));








Display PDF files in Web pages and popup pdf in Vue project


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.