Browsing PDF in a web page without using Flash

試著忘記壹切 提交于 2019-12-25 08:25:59

问题


I Have an N-Pages PDF linked in a my web page.

I want to be able to browse the PDF, with next and prev arrows, page numbers, etc etc

I want to be able to browse the PDF without using any Flash Plugin.

I also want to normalize the browsing behaviour, so i don't want to use the default PDF plugin of the browser.

I'm looking for a JS plugin but i don't find interesting solutions.

Any other suggestions?


回答1:


You can try this way:

See my code below:

 $("a[href*=.pdf]").click(function(){
    window.open(this.href);
    return false;
});

Alternatively, you can apply the target="_self" attribute instead:

 $("a[href*=.pdf]").click(function(){
    $(this).attr({"target":"_self"});
    return false;
});

EDIT:

If you need a plugin here it is https://github.com/andreasgal/pdf.js

Demo for the plugin http://deanhume.com/content/postimages/pdfjs/pdfjs.htm#1



来源:https://stackoverflow.com/questions/10380963/browsing-pdf-in-a-web-page-without-using-flash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!