Display PDF file in HTML page to realize online reading __html

Source: Internet
Author: User
Tags pdfobject

Reference article: 1.http://blog.csdn.net/broze/article/details/6743314

2.http://www.pdfobject.com/


Requirements: You need to embed PDF files in HTML pages to achieve online reading.

Scene: PDF file, my pdf file is the 20141212apple.pdf and boy.pdf files in the code, saved in the current Web application:

Webroot/test/20141212apple.pdf

Webroot/test/20141212boy.pdf

Therefore, it is not possible to test cross-domain access. According to the reference blog, there seems to be a problem.

Implementation: 1. Need to download a third party JS plugin, pdfobject.js

2. The client browser requires PDF plugin support.

Browsers: CHROME,FIREFOX,IE8 can support


___ Code


</PRE><PRE> 
<script type= "Text/javascript" src= "$! {frontimageserver}/js/jquery.js "></script> <script type=" Text/javascript "src=" $! {frontimageserver}/scripts/pdfobject.js "></script> <script type= ' text/javascript ' > window.onload= 
          function () {new Pdfobject {url: ' test/20141212apple.pdf ', Pdfopenparams: {view: ' Fit ', 
	  ScrollBars: ' 0 ', toolbar: ' 0 ', StatusBar: ' 0 ', Navpanes: ' 0 '}}. Embed (' pdf1 ');
	  
	  }; Click on Trigger targetdivid: Display PDF divID. 
          Pdfurl:pdf Resource Path function readMe (targetdivid,pdfurl) {new Pdfobject ({url:pdfurl, pdfopenparams: { View: ' Fit ', scrollbars: ' 0 ', toolbar: ' 0 ', StatusBar: ' 0 ', Navpanes: 
	  ' 0 '}}). Embed (Targetdivid); } </script> <!--PDF test--> <div style= "FONT-SIZE:18PX;" >----directly loaded PDF----</div> <div id= "pdf1" style= "height:375px;" > It appears you don ' t have AdobeReader or PDF support in the this web browser. <a href= "/test/20141212apple.pdf" >click here to download the pdf</a></div> </div>  




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.