页:1
完全通过,先进的例子,和API的参考文献,在我们的文件网站上:
👉 https://www.embedpdf.com/docs/spippet/introduction (中文(简体) )
导 言
嵌入PDF 片断 是一个 “包括电池” 掉入,变成任何 <div> 成为专业的PDF阅读器. 没有建设步骤, 没有框架锁 — — 只要复制、粘贴, 你就可以了.
为什么选择片段?
- 完成 UI 退出 - 工具栏、缩略图、搜索、缩放和更多
- 零建设工具 - 使用简单的HTML网页或与任何联署材料框架并行
- 30 秒设置 -一个
<script type="module">这是你所需要的 - 完全可配置 - 用轻量级选项对象调整行为
- 到处跑 - 现代浏览器、框架、静态网站和CMS
QQ 快速安装
添加CDN模块并将其指向容器:
<div id="pdf-viewer" style="height: 500px"></div>
<script async type="module">
import EmbedPDF from 'https://cdn.jsdelivr.net/npm/@embedpdf/snippet@2/dist/embedpdf.js';
const viewer = EmbedPDF.init({
type: 'container', // mount strategy
target: document.getElementById('pdf-viewer'),
src: 'https://snippet.embedpdf.com/ebook.pdf', // your PDF URL
});
</script>
并享受一个满满的观众.
基本使用模式
- 集装箱 - 创建查看器将渲染的 DOM 元素 .
- 导入 - 负载
embedpdf.js发件人:type="module"。 。 。 . - 初始化 - 打电话
EmbedPDF.init()与您的配置.
最小示例
<!DOCTYPE html>
<html>
<head>
<title>My PDF Viewer</title>
</head>
<body>
<div id="pdf-viewer" style="height: 100vh"></div>
<script async type="module">
import EmbedPDF from 'https://cdn.jsdelivr.net/npm/@embedpdf/snippet@2/dist/embedpdf.js';
const viewer = EmbedPDF.init({
type: 'container',
target: document.getElementById('pdf-viewer'),
src: 'https://snippet.embedpdf.com/ebook.pdf',
});
</script>
</body>
</html>
许可证
嵌入式PDF 片断是 麻省理工学院执照商业用途是受欢迎的——保持版权标题完整.