在没有 Adob​​e Reader 的情况下将 pdf 文件显示到浏览器中

发布于 2025-01-05 18:13:37 字数 90 浏览 3 评论 0原文

我需要在没有 Adob​​e Reader 的情况下在浏览器中打开 pdf 文件。是否有 PHP 的 API 可以在浏览器中打开 PDF 文件。

问候

I need to open pdf file into browser without Adobe Reader. Is there any API with php which open PDF files into browser.

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

故事未完 2025-01-12 18:13:37

不会

。PHP 在服务器上运行。它可以访问的唯一“浏览器 API”是 HTTP。

如果你想在客户端渲染PDF,那么客户端需要一个PDF渲染器。有 JavaScript PDF 阅读器,但我无法评论他们的交叉 -浏览器支持或成熟度。

No.

PHP runs on the server. The only "browser API" it has access to is HTTP.

If you want to render a PDF on the client, then the client needs a PDF renderer. There are JavaScript PDF readers, but I can't comment on their cross-browser support or maturity.

友欢 2025-01-12 18:13:37

您可以使用 SWFTools 将 PDF 转换为 Flash。但是SWFTools的默认皮肤看起来一点也不好看,所以你可以作为查看器查看Flexpaper
如果您要制作自己的皮肤,那么阅读以下内容可能会有所帮助:SWFTools (pdf2swf)使用 Flex

另一个解决方案是 pdf.js (正如 Quentin 指出的那样),但是 AFAIR 这个脚本对于具有复杂结构(例如复杂渐变)的 PDF 不可用(当时,当我寻找时)。

如果您需要将文档发布为“私人”,您应该将服务视为 Issuu,否则您将不得不保护文件免遭下载。

You can use SWFTools to convert PDFs to Flash. But SWFTools default skins are not looking good at all, so you can check Flexpaper as a viewer.
In case you are going to make your own skin, then could be useful to read: SWFTools (pdf2swf) to properly work with Flex

Another solution is pdf.js (as Quentin point out), but AFAIR this script was not usable(back then, when I looked for) for PDFs with complex structures (complex gradients for example).

If you need to publish documents as "private" you should look at services as Issuu or you will have to protect files from downloading.

清晨说晚安 2025-01-12 18:13:37

如果您的 pdf 文件放在网上且不受限制,您可以尝试使用 Google Doc Viewer。将查看器放入 中是一种非常好的方法,这样它就可以与您的网页结合起来。

https://docs.google.com/viewer

If you pdf files are put online and not restricted, you can try using Google Doc Viewer. It's a very nice way to put the Viewer in <iframe /> so that it can be combined with your web page.

https://docs.google.com/viewer

小嗲 2025-01-12 18:13:37

如果没有 Adob​​e Reader 等查看器,则无法查看 PDF 文件。如果您只是不想使用 Adob​​e Reader,您可以尝试使用其他公司的 Web 浏览器 PDF 查看器插件。

但是,如果您根本不想使用查看器并希望编写/构建自己的查看器,那么更好的选择是将 PDF 转换为可缩放图像,然后使用图像标签在网页上显示它们。您还可以使用 JavaScript 创建这样的查看器。

您甚至可以找到许多已经可用的基于 JavaScript 的查看器,可以显示这些图像。

It is not feasible to view the PDF files without a viewer like Adobe Reader. If you just don't want to use Adobe Reader, you may try a PDF viewer plug in for web browser from some other company.

However, if you do not want to use a viewer at all and want to write/build your own viewer then a better option is to convert the PDF to scalable images and then show them on the web page using image tags. You can also create such a viewer using JavaScript.

Even you can find many already available JavaScript based viewers which can show those images.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文