在移动浏览器中嵌入PDF [英] Embed PDF in mobile browsers

查看:197
本文介绍了在移动浏览器中嵌入PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面有我的代码,它是我所需的完美解决方案,它实际上是将JPG,GIF,PNG或PDF文件嵌入到我的网页中.它可以在PC浏览器中完美运行,但是由于其目标用户,因此页面的关键要求是使其与移动浏览器兼容.

I have the code below which is a perfect solution to what I need, which would essentially be embedding any of JPG, GIF, PNG or PDF files in my webpages. It works perfectly in PC browsers, but a critical requirement for the pages is to have them compatible in mobile browsers due to its target users.

<iframe src="uploads/test1.pdf" width="auto" height="auto"> </iframe>

尽管图像文件可以正常工作,但是PDF文件在移动浏览器中是单独打开的,而不是内嵌在网页中.什么是对此的替代解决方案或实现?

Although image files work fine, PDF files are opened separately in the mobile browser and not embedded inline in the web page. What would be an alternative solution or implementation to this?

推荐答案

您可以使用PDFJs库.仅使用JS,您就可以渲染pdf文件. 请在这里检查: https://mozilla.github.io/pdf.js/

You can use PDFJs library. Using just JS you can render pdf files. Please , check here : https://mozilla.github.io/pdf.js/

这篇关于在移动浏览器中嵌入PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆