Package Exports
- @embedpdf/snippet
- @embedpdf/snippet/dist/embedpdf.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@embedpdf/snippet) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
EmbedPDF Snippet
The easiest way to embed PDF files in your website with a complete, ready‑to‑use interface.
📚 Documentation
The full walkthrough, advanced examples, and API reference live in our docs site:
👉 https://www.embedpdf.com/docs/snippet/introduction
🚀 Introduction
EmbedPDF Snippet is a “batteries‑included” drop‑in that turns any <div> into a professional PDF reader. No build step, no framework lock‑in—just copy, paste, and you’re done.
Why choose the Snippet?
- Complete UI out‑of‑the‑box – toolbar, thumbnails, search, zoom & more
- Zero build tooling – works in plain HTML pages or alongside any JS framework
- 30‑second setup – a single
<script type="module">is all you need - Fully configurable – tweak behavior with a lightweight options object
- Runs everywhere – modern browsers, frameworks, static sites & CMSes
⚡️ Quick Install
Add the CDN module and point it at a container:
<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>That’s it—refresh and enjoy a full‑featured viewer.
🛠 Basic Usage Pattern
- Container – create a DOM element where the viewer will render.
- Import – load
embedpdf.jsfrom the CDN withtype="module". - Initialize – call
EmbedPDF.init()with your configuration.
Minimal Example
<!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>📄 License
EmbedPDF Snippet is MIT licensed. Commercial use is welcome—just keep the copyright headers intact.