# PDFObject.js、jquerymedia.js、pdf.js的对比

## Why use PDFObject?

PDFObject 2.0 detects browser support for inline/embedded PDFs. (In case you were wondering, your browser supports embedded PDFs. You lucky dog, you!)

If you're working with dynamic HTML, such as a single-page web app, you may need to insert PDFs on-the-fly. However, PDF embedding is not supported by certain browsers. If you insert markup without first checking for PDF support, you could wind up with missing content or a broken UI.

The PDFObject utility helps you avoid these situations by detecting support for PDF embedding in the browser; if embedding is supported, the PDF is embedded. If embedding is NOT supported by the browser, the PDF will NOT be embedded.

By default, PDFObject 2.0 inserts a fallback link to the PDF when the browser does not support inline PDFs. This ensures your users always have access to your PDF, and is designed to help you write less code. The fallback link can be customized, or the option can be disabled if you prefer.

PDFObject 2.0 is npm-ready. Modern web apps use npm to manage packages and dependencies. PDFObject 2.0 is registered with Node Package Manager (npm) and can be loaded dynamically.

PDFObject also makes it easy to specify Adobe's proprietary "PDF Open Parameters". (Be warned these parameters are only supported by Adobe Reader, most PDF readers will ignore the parameters, including the built-in PDF readers in Chrome, Internet Explorer, and Safari. Read more below.)

PDFObject 2.0检测浏览器支持嵌入式/嵌入式PDF。 （如果你想知道，你的浏览器支持嵌入式PDF，你幸运的狗，你！）

PDFObject 2.0已经准备好了。现代网络应用程序使用npm来管理软件包和依赖项。 PDFObject 2.0已在Node Package Manager（npm）中注册，可以动态加载。

## What PDFObject doesn't do

PDFObject is not a rendering engine. PDFObject just writes an <embed> element to the page, and relies on the browser or browser plugins to render the PDF. If the browser does not support embedded PDFs, PDFObject is not capable of forcing the browser to render the PDF.

If you need to force browsers to display a PDF, we suggest using Mozilla's PDF.js. Note that PDF.js is subject to its own limitations, such as cross-domain security restrictions. PDFObject and PDF.js play well together, there are links to some great PDF.js examples in the Examples section below.

PDFObject does not provide the ability to customize the look and feel of the PDF toolbar. The toolbar is controlled by the browser, and will vary widely from browser to browser (Chrome versus Safari versus Firefox, etc.). Some of these browsers provide the ability to show or hide the toolbar, or a feature such as the search field, via PDF Open Parmeters. However, in general the browsers do NOT provide any mechanism for customizing the toolbar. If you really need to customize the toolbar, try forking Mozilla's PDF.js and customizing it to suit your needs.

PDFObject does not validate the existence of the PDF, or that the PDF is actually rendered. The assumption is that you are specifying a valid URL and the network is functioning normally. PDFObject does not check for 404 errors, and JavaScript cannot detect whether the PDF actually renders, unless you are using PDF.js, which is outside the scope of PDFObject.

PDFObject does not magically implement PDF Open Parameters. As mentioned above, these parameters are not widely supported. The PDF rendering engine either supports them or doesn't — PDFObject cannot force the rendering engine to implement these features.

PDFObject不是一个渲染引擎。 PDFObject只是将一个<embed>元素写入页面，并依赖于浏览器或浏览器插件来呈现PDF。如果浏览器不支持嵌入式PDF，PDFObject不能强制浏览器呈现PDF。

PDFObject不提供自定义PDF工具栏的外观的功能。工具栏由浏览器控制，并且从浏览器到浏览器（Chrome与Safari和Firefox等）的差异很大。其中一些浏览器提供了通过PDF打开Parmeters显示或隐藏工具栏或功能（如搜索字段）的功能。但是，一般来说，浏览器不提供自定义工具栏的任何机制。如果您真的需要自定义工具栏，请尝试针对Mozilla的PDF.js进行自定义以满足您的需求。

PDFObject不验证PDF的存在，或PDF实际呈现。假设您指定一个有效的URL，并且网络正常运行。 PDFObject不检查404错误，JavaScript无法检测PDF是否实际呈现，除非您使用的PDF.js不属于PDFObject范围。

PDFObject不会神奇地实现PDF打开参数。如上所述，这些参数不被广泛支持。 PDF渲染引擎支持它们或不支持 - PDFObject不能强制渲染引擎实现这些功能。

The jQuery Media Plugin supports unobtrusive conversion of standard markup into rich media content. It can be used to embed virtually any media type, including Flash, Quicktime, Windows Media Player, Real Player, MP3, Silverlight, PDF and more, into a web page. The plugin converts an element (usually an <a>) into a <div> which holds the object, embed or iframe tags neccessary to render the media content.

jQuery Media插件支持将标准标记转换为富媒体内容。 它可以用于将几乎任何媒体类型（包括Flash，Quicktime，Windows Media Player，Real Player，MP3，Silverlight，PDF等）嵌入到网页中。 该插件将一个元素（通常是<a>）转换成一个保存对象的<div>，需要嵌入或iframe标签才能呈现媒体内容。

3、pdf.js

• PDF.js是使用HTML5构建的便携式文档格式（PDF）查看器。
• PDF.js是由Mozilla实验室的社区驱动和支持。 我们的目标是创建一个通用的基于Web标准的平台，用于解析和渲染PDF。

posted @ 2017-07-12 09:14 大圣巴巴 阅读(...) 评论(...) 编辑 收藏