在浏览器中打开pdf文件 [英] Open pdf file in browser

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

问题描述

我有一个pdf文件,在浏览器中通过iFrame打开。

它适用于Windows和Mac机器,但在Android移动Chrome浏览器上,pdf文件不想打开。



有人对此有任何想法吗?

I have a pdf file which is open via iFrame in the browser.
It works on windows and mac machines but on android mobile chrome browser the pdf file do not want to open.

Someone have any idea about this ?

推荐答案

PDF文件通常会在浏览器中显示,甚至虽然PDF不是W3标准的一部分(据我所知)。但是你的产品绝不应该依赖它发生的假设。这通常作为浏览器插件实现。并非所有用户都拥有此选项,并非所有用户都会使用此选项。此外,您不应该假设所有用户都拥有任何PDF软件。但这根本不是问题。



您只需要将PDF放在锚标记中,作为 href中引用的文件属性。在这种情况下,具有PDF插件的用户将其加载到浏览器中。在所有其他情况下,用户可以选择使用PDF的默认软件产品集打开文件(如果有),或者下载文件。如果没有任何PDF软件,用户将只能选择一个:下载文件。这是相当公平的,因为用户将始终能够稍后查看该文档。



你不需要做任何特别的事情,事实上,没有必要做任何事情。



-SA
PDF files are routinely shown in the browsers, even though PDF is not a part of W3 standards (as far as I know). But your product should never rely on the assumption that it happens. This is usually implemented as a browser plug-ins. Not all of your users will have this option, and not all will use it. Moreover, you should not assume that all user have any PDF software at all. But this is not a problem at all.

You just need to put your PDF in a anchor tag, as a file referenced in the href attribute. In this case, the user having a PDF plug-in will have it loaded in the browser. In all other cases, the user will have either a choice to open the file using default software product set for PDFs, if any, or download the file. If there is not any PDF software, the user will be give only one choice: to download a file. This is quite fair, because the user will always be able to view the document later.

There is nothing special you need to do, and, in fact, there is no any need to do anything else.

—SA


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

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